Dockerfile.frontend 569 B

12345678910111213141516171819202122232425262728293031
  1. FROM node:22-alpine AS builder
  2. WORKDIR /app
  3. # Install dependencies
  4. COPY src/package*.json ./
  5. RUN npm install
  6. # Copy source
  7. COPY src/ ./
  8. # Build Next.js — relative API URLs (/api/...) via Next.js rewrites
  9. ENV NEXT_TELEMETRY_DISABLED=1
  10. RUN npm run build
  11. # Production image
  12. FROM node:22-alpine
  13. WORKDIR /app
  14. ENV NODE_ENV=production
  15. ENV NEXT_TELEMETRY_DISABLED=1
  16. # Copy only what's needed to run
  17. COPY --from=builder /app/node_modules ./node_modules
  18. COPY --from=builder /app/.next ./.next
  19. COPY --from=builder /app/package.json ./
  20. EXPOSE 3000
  21. CMD ["npm", "start"]