Files
BanGUI/Docker/Dockerfile.frontend
Lukas 12fe70d768 chore: bump to v0.9.19-rc.1 and add local OpenAPI build support
- Add release candidate (rc) support to release.sh with latestRC tagging
- Bump VERSION, backend pyproject.toml, and frontend package.json to 0.9.19-rc.1
- Add local frontend/openapi.json so build no longer needs running backend
- Update generate:types and validate-types.sh to use local openapi.json
- Fix frontend tests: remove unused imports/variables and update mock data
2026-05-22 20:36:14 +02:00

46 lines
1.8 KiB
Docker

# ──────────────────────────────────────────────────────────────
# 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 + local OpenAPI spec (avoids needing a running backend during 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;"]