salary-benchmark/deploy/docker-compose.prod.yml
DJP e7e177082d Mark pgdata volume external so compose stops warning about pre-existing volume
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:20:50 -04:00

42 lines
1.3 KiB
YAML

# Pin project name — compose otherwise derives it from the parent dir ("deploy"),
# which collides with every other app on this server that also lives in /opt/<app>/deploy/.
# Shared project name → shared container + volume namespace → cross-app data loss.
name: salary-benchmark
services:
db:
image: postgres:16-alpine
container_name: salary-benchmark-db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 5s
retries: 10
app:
build:
context: ..
dockerfile: deploy/Dockerfile.prod
container_name: salary-benchmark-app
restart: unless-stopped
env_file: .env.prod
depends_on:
db:
condition: service_healthy
ports:
# Bind to loopback only — Apache fronts it
- "127.0.0.1:${APP_PORT}:8000"
volumes:
pgdata:
# Volume was seeded by migrating from the old shared "deploy_pgdata".
# external: true tells compose not to try to manage lifecycle (silences
# the "not created by Docker Compose" warning).
external: true
name: salary-benchmark_pgdata