From 7486bcf939c6650e6e255c4d6ecfd5a7b97bf83d Mon Sep 17 00:00:00 2001 From: Jackson Roberts Date: Thu, 26 Feb 2026 14:35:46 -0600 Subject: [PATCH] perf: bundle server with bun build to eliminate node_modules in production --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 338db9e..41a6c57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,15 +15,16 @@ ENV PUBLIC_API_URL=$PUBLIC_API_URL RUN bun run build:server +# Bundle the server into a single file with all dependencies +RUN bun build build/index.js --target node --outdir build-bundled --minify + # Production image FROM node:22-alpine AS production WORKDIR /app -COPY --from=base /app/build ./build -COPY --from=base /app/package.json ./ - -RUN npm install --omit=dev +COPY --from=base /app/build-bundled/index.js ./index.js +COPY --from=base /app/build/client ./client ENV NODE_ENV=production ENV PORT=3000 @@ -31,4 +32,4 @@ ENV ORIGIN=https://optima.osdci.net EXPOSE 3000 -CMD ["node", "build/index.js"] +CMD ["node", "index.js"]