Skip to content

Commit 3eb4217

Browse files
committed
Try to copy bin to .devcontainer to include it in build context
1 parent cecd662 commit 3eb4217

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

envbuilder.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/kballard/go-shellquote"
2929
"github.com/mattn/go-isatty"
30+
cp "github.com/otiai10/copy"
3031

3132
"github.com/GoogleContainerTools/kaniko/pkg/config"
3233
"github.com/GoogleContainerTools/kaniko/pkg/creds"
@@ -343,8 +344,14 @@ func Run(ctx context.Context, options Options) error {
343344
}
344345

345346
if options.PushImage {
347+
// Copy the envbuilder binary into the build context.
348+
binPath := filepath.Join(MagicDir, "bin", "envbuilder")
349+
err := cp.Copy(binPath, filepath.Join(buildParams.BuildContext, binPath))
350+
if err != nil {
351+
return err
352+
}
346353
buildParams.DockerfileContent = buildParams.DockerfileContent + "\n" +
347-
"COPY .envbuilder .envbuilder"
354+
"COPY " + binPath + " " + binPath
348355
}
349356

350357
HijackLogrus(func(entry *logrus.Entry) {
@@ -526,7 +533,7 @@ func Run(ctx context.Context, options Options) error {
526533
// https://github.com/coder/envbuilder/pull/114
527534
RegistryMirrors: registryMirror,
528535
},
529-
SrcContext: "/",
536+
SrcContext: buildParams.BuildContext,
530537

531538
// For cached image utilization, produce reproducible builds.
532539
Reproducible: options.PushImage,

0 commit comments

Comments
 (0)