Skip to content

Docker and Deployment

Frody edited this page Sep 4, 2026 · 1 revision

Docker & Production Deployment

AuthForge includes production-ready Docker containers and Docker Compose definitions for both the Spring Boot backend and the client dashboard.


1. Docker Compose Multi-Container Stack

The root docker-compose.yml provisions:

  • postgres: PostgreSQL 16 database with persistent volume.
  • backend: Multi-stage built Spring Boot 3 app running on Eclipse Temurin 21 JRE.
  • frontend: Nginx web server serving the static UI dashboard.
  • mailhog: Local SMTP relay and webmail client for test verification.

Running the stack:

docker-compose up -d --build

Stopping the stack:

docker-compose down -v

2. Dockerfile Multi-Stage Build

The backend utilizes an optimized multi-stage build:

  1. Build stage: Compiles source code with Maven caching layer.
  2. Runtime stage: Strips build tools, runs as a non-root unprivileged container user on Alpine Linux / distroless base image for minimal attack surface.
# Multi-stage production execution
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=builder /workspace/target/authforge-*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]

3. Production Hardening Checklist

  1. Change Default Secrets: Ensure JWT_SECRET, DB_PASSWORD, and OAuth2 secrets are injected securely via container environment variables or Kubernetes secrets.
  2. HTTPS / TLS Termination: Terminate SSL at your reverse proxy (Nginx, Traefik, AWS ALB) and set server.forward-headers-strategy=native.
  3. Database Migration: In production environments, configure Flyway or Liquibase by setting spring.jpa.hibernate.ddl-auto=validate.