- docker-compose.yml (dev): 3 services — postgres:16, backend (gradle bootRun with JDK 21, spring-boot-devtools), frontend (Vite HMR on node:24-alpine). Source volume mounts for live editing, Gradle cache volume for fast rebuilds, pg_isready healthcheck on postgres. - docker-compose.prod.yml (prod): same 3 services but with multi-stage Dockerfiles. Backend: Gradle bootJar → JRE Alpine, non-root user. Frontend: npm ci + vite build → nginx:alpine serving static dist/. SSL termination via self-signed cert (auto-generated in entrypoint). No source mounts, restart: unless-stopped, separate volumes. - application-docker.yml: Spring profile overriding H2 with PostgreSQL via env vars. Hostname "postgres" resolved by Docker Compose DNS. - Vite proxy /api → backend:8080 for dev. nginx nginx.conf handles /api proxy + SPA fallback + gzip + SSL in prod. - AGENTS.md, README.md: architecture diagram, dev vs prod comparison table, Spring profiles docs, file reference updates.
57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16
|
|
container_name: bilhej-postgres-prod
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
volumes:
|
|
- pgdata-prod:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
build:
|
|
dockerfile: docker/backend.prod.Dockerfile
|
|
context: .
|
|
container_name: bilhej-backend-prod
|
|
ports:
|
|
- "8080:8080"
|
|
environment:
|
|
SPRING_PROFILES_ACTIVE: docker
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
|
|
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET}
|
|
STRIPE_PRICE_ID: ${STRIPE_PRICE_ID}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build:
|
|
dockerfile: docker/frontend.prod.Dockerfile
|
|
context: .
|
|
container_name: bilhej-frontend-prod
|
|
ports:
|
|
- "3000:80"
|
|
- "443:443"
|
|
depends_on:
|
|
- backend
|
|
volumes:
|
|
- certs:/etc/nginx/certs
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
pgdata-prod:
|
|
certs:
|