# ============================================================================== # Agriculture Trading Backoffice (ATB) - Frontend Production Dockerfile # Multi-stage hardened build for React/Vite/TS SPA # Standardized per UP-AI v1.5 / tech-profile.yaml # ============================================================================== # ---- Stage 1: Build Application Bundle ---- FROM node:20-alpine AS builder WORKDIR /build COPY frontend/package.json ./ # If package-lock.json exists copy it, else standard npm install RUN npm install COPY frontend/ ./ RUN npm run build # ---- Stage 2: Hardened Nginx Runtime ---- FROM nginx:1.27-alpine AS runtime LABEL maintainer="ATB Engineering Team" LABEL version="1.0.0" LABEL description="Agriculture Trading Backoffice (ATB) Frontend Web Portal" # Remove default nginx static assets RUN rm -rf /usr/share/nginx/html/* # Copy built artifacts from builder stage COPY --from=builder /build/dist /usr/share/nginx/html # Copy custom hardened nginx configuration COPY docker/nginx.conf /etc/nginx/nginx.conf # Set permissions for nginx cache and run folders RUN touch /var/run/nginx.pid && \ chown -R nginx:nginx /var/run/nginx.pid /var/cache/nginx /usr/share/nginx/html EXPOSE 80 # Production Healthcheck HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://127.0.0.1/healthz || exit 1 CMD ["nginx", "-g", "daemon off;"]