# 👉 Build stage FROM node:18 AS builder WORKDIR /app # ติดตั้ง dependencies COPY package*.json ./ RUN npm install # คัดลอก source code ทั้งหมด COPY . . # สร้าง production build RUN npm run build # 👉 Production stage FROM nginx:stable-alpine # คัดลอกไฟล์ที่ build แล้ว ไปยัง nginx COPY --from=builder /app/dist /usr/share/nginx/html # คัดลอก public folder เข้าไปด้วย (เผื่อมีรูปหรือ static อื่นๆ) COPY public /usr/share/nginx/html # 🔧 (ถ้ามี custom nginx config) # COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]