# ────────────────────────────────────────────────────────────── # BanGUI — Frontend image (React / Vite → nginx) # # Compatible with Docker and Podman. # Build context must be the project root. # # Usage: # docker build -t bangui-frontend -f Docker/Dockerfile.frontend . # podman build -t bangui-frontend -f Docker/Dockerfile.frontend . # ────────────────────────────────────────────────────────────── # ── Stage 1: install & build ───────────────────────────────── FROM docker.io/library/node:22-alpine AS builder WORKDIR /build # Install dependencies first (layer caching) COPY frontend/package.json frontend/package-lock.json* /build/ RUN npm ci --ignore-scripts # Copy source and build COPY frontend/ /build/ RUN npm run build # ── Stage 2: serve with nginx ──────────────────────────────── FROM docker.io/library/nginx:1.27-alpine AS runtime LABEL maintainer="BanGUI" \ description="BanGUI frontend — fail2ban web management UI" # Remove default nginx content RUN rm -rf /usr/share/nginx/html/* # Copy built assets COPY --from=builder /build/dist /usr/share/nginx/html # Custom nginx config for SPA routing + API reverse proxy COPY Docker/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ CMD wget -qO /dev/null http://localhost:80/ || exit 1 CMD ["nginx", "-g", "daemon off;"]