all repos — homestead @ 9309eb18352035f9c6e556e4e01969da1a708a1f

Code for my website

docker: use bun compiler to generate single file executable

Alan Pearce
commit

9309eb18352035f9c6e556e4e01969da1a708a1f

parent

d64bda80844c535cb2a29c633f3040ce29f6ca3c

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

jump to
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" ]