Spaces:
Running
Running
| # ── Stage 1: Build React app ────────────────────────────────────────────────── | |
| FROM node:20-alpine AS builder | |
| WORKDIR /app | |
| COPY package.json package-lock.json ./ | |
| RUN npm ci --frozen-lockfile | |
| COPY . . | |
| RUN npm run build | |
| # ── Stage 2: Serve with Nginx ───────────────────────────────────────────────── | |
| FROM nginx:alpine AS runtime | |
| # Remove default nginx config | |
| RUN rm /etc/nginx/conf.d/default.conf | |
| # Copy custom nginx config | |
| COPY nginx.conf /etc/nginx/conf.d/app.conf | |
| # Copy built React app | |
| COPY --from=builder /app/dist /usr/share/nginx/html | |
| EXPOSE 80 | |
| CMD ["nginx", "-g", "daemon off;"] | |