Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerbuild: Copy encore.dev instead of linking #1657

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/dockerbuild/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,9 @@ func (b *imageSpecBuilder) Describe(cfg DescribeConfig) (*ImageSpec, error) {
{
for _, out := range cfg.Compile.Outputs {
if _, ok := out.(*builder.JSBuildOutput); ok {
// Include the encore.dev package, at the same location.
runtimeSrc := cfg.Runtimes.Join("js", "encore.dev")
b.spec.CopyData[runtimeSrc.ToImage()] = runtimeSrc

// Add the encore-runtime.node file, and set the environment variable to point to it.
nativeRuntimeHost := cfg.NodeRuntime.GetOrElse(cfg.Runtimes.Join("js", "encore-runtime.node"))
nativeRuntimeImg := nativeRuntimeHost.ToImage().Dir().Join("encore-runtime.node")
nativeRuntimeImg := ImagePath("/encore/runtimes/js/encore-runtime.node")
b.spec.CopyData[nativeRuntimeImg] = nativeRuntimeHost
b.spec.Env = append(b.spec.Env, fmt.Sprintf("ENCORE_RUNTIME_LIB=%s", nativeRuntimeImg))
b.addPrio(nativeRuntimeImg)
Expand Down
12 changes: 12 additions & 0 deletions pkg/dockerbuild/tarcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"time"

"encr.dev/internal/env"
"encr.dev/pkg/xos"
"encr.dev/v2/compiler/build"
"github.com/cockroachdb/errors"
Expand Down Expand Up @@ -130,6 +131,17 @@ func (tc *tarCopier) CopyDir(desc *dirCopyDesc) error {
return errors.WithStack(err)
}

// copy the files instead of linking if its the encore.dev package
if target == filepath.Join(env.EncoreRuntimesPath(), "js", "encore.dev") {
err = tc.CopyDir(&dirCopyDesc{
Spec: desc.Spec,
SrcPath: HostPath(target),
DstPath: dstPath,
ExcludeSrcPaths: map[HostPath]bool{},
})
return errors.Wrap(err, "add encore.dev package")
}

link, err = tc.rewriteSymlink(desc, path, HostPath(target))
if err != nil {
return errors.WithStack(err)
Expand Down
Loading