# Stage 1: Build FROM node:20-alpine AS builder WORKDIR /app # Install dependencies first (layer caching) COPY package.json ./ RUN npm install # Copy source and build COPY . . RUN npm run build # Stage 2: Serve FROM nginx:alpine # Remove default nginx config RUN rm /etc/nginx/conf.d/default.conf # Copy custom nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Vite dist: index.html, hashed chunks, public files (e.g. assets/game/manifest.json), # and PNGs under assets/tiles|enemies|prop|building|characters|obj (see vite.config assetFileNames). COPY --from=builder /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]