Skip to content

Commit 42d0436

Browse files
authored
[devbox] Use --link in Dockerfile (#2446)
## Summary Update the Dockerfile template used by `devbox` to use the `--link` functionality. ## How was it tested? Compiled and re-ran against example project. ## Is this change backwards-compatible? Yes.
1 parent 02812f4 commit 42d0436

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tmpl/Dockerfile.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SHELL [ "/bin/sh", "-eux", "-o", "pipefail", "-c"]
1111
WORKDIR /scratch
1212

1313
# Setup nix in its own layer so it can be cached.
14-
COPY ./default.nix .
14+
COPY --link ./default.nix ./
1515
# Setup /nix/store as a cache directory.
1616
# Declaring it as a cache directory makes it empty directory, so we need to
1717
# specify, using from= and source=, that we want to re-copy the contents of
@@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/nix/store,from=nixos/nix,source=/nix/store \
2323
# Install libraries needed by the source code.
2424
# -----------------------------------------------
2525

26-
COPY . .
26+
COPY --link . ./
2727
RUN --mount=type=cache,target=/nix/store {{.InstallCommand}}
2828

2929
# 3. BUILD PHASE
@@ -38,11 +38,11 @@ RUN --mount=type=cache,target=/nix/store {{.BuildCommand}}
3838
# Default to :debug so we have a shell.
3939
FROM gcr.io/distroless/base:debug
4040
# Setup shell so that we catch any errors early
41-
SHELL [ "/busybox/sh", "-eux", "-o", "pipefail", "-c"]
41+
SHELL [ "/busybox/sh", "-eu", "-o", "pipefail", "-c"]
4242

4343
# TODO: Improve to only copy needed files and not the entire src directory.
44-
COPY --from=builder /scratch /app
45-
WORKDIR app
44+
COPY --link --from=builder /scratch/. /app/
45+
WORKDIR /app
4646

4747
# We default to ENTRYPOINT instead of CMD as we consider it best practice
4848
# when the container is wrapping an application or service.

0 commit comments

Comments
 (0)