Dockerfile 730 B

123456789101112131415161718192021222324
  1. # Stage 1: build stage
  2. FROM node:22-alpine as build-stage
  3. # make the 'app' folder the current working directory
  4. WORKDIR /app
  5. # config node options
  6. ENV NODE_OPTIONS=--max_old_space_size=8192
  7. # config pnpm, install dependencies
  8. COPY package.json pnpm-lock.yaml* ./
  9. RUN npm install pnpm@9.x -g && \
  10. pnpm install --frozen-lockfile
  11. # copy project files and folders to the current working directory (i.e. 'app' folder)
  12. COPY . ./
  13. # build the project
  14. RUN pnpm build
  15. RUN echo "build successful 🎉 🎉 🎉"
  16. # Stage 2: production stage
  17. FROM nginx:latest as production-stage
  18. COPY --from=build-stage /app/dist /usr/share/nginx/html
  19. EXPOSE 80
  20. CMD ["nginx", "-g", "daemon off;"]
  21. RUN echo "deploy to nginx successful 🎉 🎉 🎉"