# Ideas Generator 2025 - Frontend Dockerfile # Multi-stage build for production optimization # Build stage FROM node:18-alpine as build-stage WORKDIR /app # Copy package files COPY admin/package*.json ./ # Install dependencies RUN npm ci && npm cache clean --force # Copy source code COPY admin/ ./ # Build the application for production RUN npm run build # Production stage FROM nginx:alpine as production-stage # Install envsubst for environment variable substitution RUN apk add --no-cache gettext # Copy built application from build stage COPY --from=build-stage /app/dist /usr/share/nginx/html # Copy nginx configuration template COPY docker/nginx/nginx.conf.template /etc/nginx/nginx.conf.template # Copy entrypoint script COPY docker/scripts/frontend-entrypoint.sh /docker-entrypoint.d/40-envsubst-frontend.sh RUN chmod +x /docker-entrypoint.d/40-envsubst-frontend.sh # Create non-root user RUN adduser -D -s /bin/sh nginx-user # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:80/health || exit 1 # Expose port 80 EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]