diff options
author | 2023-09-28 05:49:33 +1300 | |
---|---|---|
committer | 2023-09-27 09:49:33 -0700 | |
commit | a5f76e690ac49ac273d41feef801f54e4346cef0 (patch) | |
tree | 1ff53f7e2df06f814a69e958ba68d1a5dc0efb59 | |
parent | a0081f9e29e72ae800373b536e03fe1d729c68ae (diff) | |
download | bun-a5f76e690ac49ac273d41feef801f54e4346cef0.tar.gz bun-a5f76e690ac49ac273d41feef801f54e4346cef0.tar.zst bun-a5f76e690ac49ac273d41feef801f54e4346cef0.zip |
fix: Docker - Apply workaround with `RUN` to symlink `bunx` (#6100)
Using `RUN --mount`, we can run the command with the build stage files overlayed for the `ln` and `which` commands.
`/bin` is a symlink to `/usr/bin`, both seem required to work correctly.
-rw-r--r-- | dockerhub/distroless/Dockerfile | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/dockerhub/distroless/Dockerfile b/dockerhub/distroless/Dockerfile index 5c654b77b..6a89c8d28 100644 --- a/dockerhub/distroless/Dockerfile +++ b/dockerhub/distroless/Dockerfile @@ -52,16 +52,18 @@ RUN apt-get update -qq \ && mv "bun-linux-$build/bun" /usr/local/bin/bun \ && rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \ && chmod +x /usr/local/bin/bun \ - && ln -s /usr/local/bin/bun /usr/local/bin/bunx \ && which bun \ - && which bunx \ && bun --version FROM gcr.io/distroless/base-nossl-debian11 -# List of sources to destination (final path): -COPY --from=build \ - /usr/local/bin/bun /usr/local/bin/bunx \ - /usr/local/bin/ +COPY --from=build /usr/local/bin/bun /usr/local/bin/ + +# Temporarily use the `build`-stage image binaries to create a symlink: +RUN --mount=type=bind,from=build,source=/usr/bin,target=/usr/bin \ + --mount=type=bind,from=build,source=/bin,target=/bin <<EOF + ln -s /usr/local/bin/bun /usr/local/bin/bunx + which bunx +EOF ENTRYPOINT ["/usr/local/bin/bun"] |