all repos — website @ 8141685a940a33873ae6684a3aa07809c515dfc8

My website

docker: use bun compiler to generate single file executable

Alan Pearce
commit

8141685a940a33873ae6684a3aa07809c515dfc8

parent

848980f481fec6fdc5f607cce2db7f2c77db0c58

1 file changed, 7 insertions(+), 3 deletions(-)

changed files
M DockerfileDockerfile
@@ -30,6 +30,9 @@ COPY --link static static
ENV NODE_ENV=production RUN bun run bin/build.ts +RUN rm -fr node_modules +COPY --from=install /temp/prod/node_modules node_modules +RUN bun build src/index.ts --compile --minify --sourcemap --outfile server FROM alpine:20240329 as postprocess
@@ -47,11 +50,12 @@ RUN make format
RUN make -j4 compress # Final stage for app image -FROM base +FROM gcr.io/distroless/base-nossl + +WORKDIR /app # Copy built application COPY config.toml /app/ -COPY --from=install /temp/prod/node_modules node_modules COPY --from=build /app /app COPY --from=postprocess /app/public /app/public
@@ -60,4 +64,4 @@ EXPOSE 3000
EXPOSE 9091 ENV NODE_ENV=production -CMD [ "bun", "run", "src/index.ts" ] +CMD [ "/app/server" ]