frontend.Dockerfile 531 B

1234567891011121314151617181920212223242526
  1. # Stage 1: Build Stage
  2. FROM node:22.9.0 AS build
  3. WORKDIR /app
  4. # Copy package.json and yarn.lock
  5. COPY package.json ./
  6. COPY yarn.lock ./
  7. # Install dependencies
  8. RUN yarn install --frozen-lockfile
  9. # Copy source code
  10. COPY . .
  11. # Build the application
  12. RUN yarn build
  13. # Stage 2: Production Stage
  14. FROM nginx:latest
  15. # Copy built files from the build stage to the production image
  16. COPY --from=build /app/dist /usr/share/nginx/html
  17. # Container startup command for the web server (nginx in this case)
  18. CMD ["nginx", "-g", "daemon off;"]