# Build stage for staging environment FROM node:20-alpine AS builder WORKDIR /app # Install pnpm RUN npm install -g pnpm # Copy package files COPY package.json pnpm-lock.yaml ./ # Install dependencies RUN pnpm install --frozen-lockfile # Copy source code COPY . . # Build the application for staging RUN pnpm run build -- --configuration staging # Production stage - serve with nginx FROM nginx:alpine # Copy nginx configuration COPY nginx.conf /etc/nginx/nginx.conf # Copy built application from builder stage COPY --from=builder /app/dist/pos.client/browser /usr/share/nginx/html # Expose port EXPOSE 5000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1 # Start nginx CMD ["nginx", "-g", "daemon off;"]