# Stage 1: build
FROM node:20-alpine AS builder
WORKDIR /work
COPY package.json ./
RUN npm install --no-package-lock
COPY . .
RUN npm run build

# Stage 2: nginx
FROM nginx:alpine
COPY --from=builder /work/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
