@@ -259,11 +259,15 @@ func Run(ctx context.Context, options Options) error {
259259 var (
260260 buildParams * devcontainer.Compiled
261261 scripts devcontainer.LifecycleScripts
262+
263+ devcontainerPath string
262264 )
263265 if options .DockerfilePath == "" {
264266 // Only look for a devcontainer if a Dockerfile wasn't specified.
265267 // devcontainer is a standard, so it's reasonable to be the default.
266- devcontainerPath , devcontainerDir , err := findDevcontainerJSON (options )
268+ var devcontainerDir string
269+ var err error
270+ devcontainerPath , devcontainerDir , err = findDevcontainerJSON (options )
267271 if err != nil {
268272 options .Logger (notcodersdk .LogLevelError , "Failed to locate devcontainer.json: %s" , err .Error ())
269273 options .Logger (notcodersdk .LogLevelError , "Falling back to the default image..." )
@@ -661,6 +665,13 @@ func Run(ctx context.Context, options Options) error {
661665 maps .Copy (containerEnv , buildParams .ContainerEnv )
662666 maps .Copy (remoteEnv , buildParams .RemoteEnv )
663667
668+ // Set Envbuilder runtime markers
669+ containerEnv ["ENVBUILDER" ] = "true"
670+ if devcontainerPath != "" {
671+ containerEnv ["DEVCONTAINER" ] = "true"
672+ containerEnv ["DEVCONTAINER_CONFIG" ] = devcontainerPath
673+ }
674+
664675 for _ , env := range []map [string ]string {containerEnv , remoteEnv } {
665676 envKeys := make ([]string , 0 , len (env ))
666677 for key := range env {
0 commit comments