web: use multi-stage building for the container file

This commit is contained in:
rhpidfyre 2024-12-14 00:07:59 -05:00
parent f0c39f5837
commit 49da5f6eb1
2 changed files with 23 additions and 14 deletions

View File

@ -1,4 +1,15 @@
node_modules
build
bun.lockb
.gitignore
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*

View File

@ -1,21 +1,19 @@
FROM oven/bun:latest
FROM oven/bun AS build
WORKDIR /app
COPY . .
EXPOSE 3000
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN bun install && bun run build
RUN bun install
RUN bun run build
FROM build AS release
RUN rm -rf src eslint.config.mjs tsconfig.json
WORKDIR /app
RUN bun remove "@emotion/react" "@emotion/styled" "@mui/icons-material" "@mui/material" "react" "react-dom" "sass"
# bun prune --production
# Uh-oh. bun prune is a subcommand reserved for future use by Bun.
RUN bun remove "typescript" "@types/node" "@types/react" "@types/react-dom" "eslint" "eslint-config-next" "@eslint/eslintrc"
COPY --from=build /app/build ./.next
RUN bun add next
ENTRYPOINT ["bun", "run", "start"]
EXPOSE 3000
ENTRYPOINT ["bun", "run", "env", "--", "next", "start", "-p", "3000"]