# GitDataAI Frontend Dockerfile # Multi-stage build for React application with Bun # Stage 1: Build the application FROM node:24-bookworm AS builder # Install bun RUN npm install -g bun # Create app directory WORKDIR /app # Copy package files COPY package.json bun.lock ./ # Install dependencies RUN bun install --frozen-lockfile # Copy source code COPY src/ src/ COPY public/ public/ COPY index.html ./ COPY vite.config.ts ./ COPY tsconfig*.json ./ COPY eslint.config.js ./ COPY components.json ./ COPY orval.config.ts ./ # Build the application RUN bun run build # Stage 2: Create runtime image with Nginx FROM nginx:alpine # Copy custom nginx configuration COPY docker/nginx.conf /etc/nginx/conf.d/default.conf # Copy built assets from builder COPY --from=builder /app/dist /usr/share/nginx/html # Create non-root user RUN adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx appuser # Set ownership RUN chown -R appuser:nginx /var/cache/nginx \ && chown -R appuser:nginx /var/log/nginx \ && chown -R appuser:nginx /etc/nginx/conf.d \ && touch /var/run/nginx.pid \ && chown -R appuser:nginx /var/run/nginx.pid # Switch to non-root user USER appuser # Expose port EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1 # Start Nginx CMD ["nginx", "-g", "daemon off;"]