# Stage 1: Build the application FROM node:20.19-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build # Stage 2: Serve the application FROM node:20.19-alpine WORKDIR /app COPY --from=builder /app ./ ENV NODE_ENV=production ENV PORT=8080 EXPOSE 8080 CMD ["npm", "start"]