# 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//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