# 빌드 단계: vite 로 dist/ 만든다
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json ./
RUN npm install --no-audit --no-fund
COPY . ./
RUN npm run build

# 서빙 단계: nginx 가 정적으로 dist/ 를 서빙한다.
# (vite preview 는 dev/preview 용이고 docker production 환경에서 연결 끊김
#  현상이 보고된 적이 있어 nginx 정적 서빙으로 통일)
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
