@@ -259,11 +259,15 @@ func Run(ctx context.Context, options Options) error {
259
259
var (
260
260
buildParams * devcontainer.Compiled
261
261
scripts devcontainer.LifecycleScripts
262
+
263
+ devcontainerPath string
262
264
)
263
265
if options .DockerfilePath == "" {
264
266
// Only look for a devcontainer if a Dockerfile wasn't specified.
265
267
// 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 )
267
271
if err != nil {
268
272
options .Logger (notcodersdk .LogLevelError , "Failed to locate devcontainer.json: %s" , err .Error ())
269
273
options .Logger (notcodersdk .LogLevelError , "Falling back to the default image..." )
@@ -661,6 +665,13 @@ func Run(ctx context.Context, options Options) error {
661
665
maps .Copy (containerEnv , buildParams .ContainerEnv )
662
666
maps .Copy (remoteEnv , buildParams .RemoteEnv )
663
667
668
+ // Set Envbuilder runtime markers
669
+ containerEnv ["ENVBUILDER" ] = "true"
670
+ if devcontainerPath != "" {
671
+ containerEnv ["DEVCONTAINER" ] = "true"
672
+ containerEnv ["DEVCONTAINER_CONFIG" ] = devcontainerPath
673
+ }
674
+
664
675
for _ , env := range []map [string ]string {containerEnv , remoteEnv } {
665
676
envKeys := make ([]string , 0 , len (env ))
666
677
for key := range env {
0 commit comments