Add production docker-compose file

Uses pre-built images from the Gitea container registry, runs Alembic
migrations before API startup, and keeps the database password configurable
via environment variable. No source mounts or debug mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 17:58:55 +01:00
parent 349a0cb821
commit d9d547ef53
2 changed files with 41 additions and 2 deletions

View File

@@ -1,10 +1,11 @@
--- ---
# nuzlocke-tracker-vpn5 # nuzlocke-tracker-vpn5
title: Create production docker-compose file title: Create production docker-compose file
status: todo status: in-progress
type: task type: task
priority: normal
created_at: 2026-02-09T15:30:41Z created_at: 2026-02-09T15:30:41Z
updated_at: 2026-02-09T15:30:41Z updated_at: 2026-02-09T16:57:11Z
parent: nuzlocke-tracker-ahza parent: nuzlocke-tracker-ahza
--- ---

38
docker-compose.prod.yml Normal file
View File

@@ -0,0 +1,38 @@
services:
api:
image: gitea.nerdboden.de/julian/nuzlocke-tracker-api:latest
command: >
sh -c "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000 --app-dir src"
environment:
- DEBUG=false
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/nuzlocke
depends_on:
db:
condition: service_healthy
restart: unless-stopped
frontend:
image: gitea.nerdboden.de/julian/nuzlocke-tracker-frontend:latest
ports:
- "8080:80"
depends_on:
- api
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=nuzlocke
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
postgres_data: