services: postgres: image: postgres:17 container_name: amare-postgres restart: unless-stopped ports: - "${DB_PORT:-5432}:5432" environment: POSTGRES_DB: ${DB_DATABASE:-amare} POSTGRES_USER: ${DB_USERNAME:-amare} POSTGRES_PASSWORD: ${DB_PASSWORD:-secret} volumes: - amare_postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-amare} -d ${DB_DATABASE:-amare}"] interval: 5s timeout: 5s retries: 10 start_period: 10s # Local parity with the FrankenPHP image used on staging/production. # Manual smoke test (not run in CI — the `container` job already builds and # health-checks the same Dockerfile-based image): # docker compose up -d # curl localhost:8000/up app: build: context: . dockerfile: Dockerfile container_name: amare-app restart: unless-stopped depends_on: postgres: condition: service_healthy env_file: - .env environment: # Override host-side .env defaults: DB_HOST=127.0.0.1 only resolves for # processes running on the host, not for this container reaching the # `postgres` service by its Compose service name. DB_PORT is also # forced back to Postgres's internal container port (5432) — .env may # have DB_PORT remapped for host-side tooling (e.g. to avoid a local # port clash), but that remapping only applies to the published host # port, never to container-to-container traffic. DB_HOST: postgres DB_PORT: "5432" ports: - "8000:8000" volumes: amare_postgres_data: