diff options
author | Alan Pearce | 2024-04-11 17:14:00 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-11 17:14:00 +0200 |
commit | 8141685a940a33873ae6684a3aa07809c515dfc8 (patch) | |
tree | b4c1c1a7d43bcbab5730047ea13fef1d26c8fe43 | |
parent | 848980f481fec6fdc5f607cce2db7f2c77db0c58 (diff) | |
download | website-8141685a940a33873ae6684a3aa07809c515dfc8.tar.lz website-8141685a940a33873ae6684a3aa07809c515dfc8.tar.zst website-8141685a940a33873ae6684a3aa07809c515dfc8.zip |
docker: use bun compiler to generate single file executable
-rw-r--r-- | Dockerfile | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile index 915a6a9..3724bf3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] |