52 lines
1.9 KiB
YAML
52 lines
1.9 KiB
YAML
# EPPP Docker Compose baseline — [E00-S02-T01/T02]
|
|
#
|
|
# `docker compose up -d` starts both the database (PostgreSQL) and the
|
|
# application (@personal-blog/server). Rollback: `docker compose down`.
|
|
#
|
|
# PostgreSQL health gate (T02): the `db` service carries a `pg_isready`
|
|
# healthcheck and the `app` service depends on it with
|
|
# `condition: service_healthy`, so the application does not start until the
|
|
# database is accepting connections.
|
|
#
|
|
# Explicitly out of scope for T01/T02 (land in later E00-S02 tasks):
|
|
# - application health endpoint (T03)
|
|
# - DB volume persistence (T04)
|
|
#
|
|
# All values have defaults so `docker compose up -d` works from a clean clone
|
|
# without a .env file (a committed .env.example template lands in E00-S04).
|
|
|
|
services:
|
|
db:
|
|
# PostgreSQL 18 on Debian bookworm — the documented runtime target
|
|
# (Technology-Stack §5.2/§5.4/§6.2, golden tuple §7; no Alpine drift).
|
|
image: postgres:18-bookworm
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-eppp}
|
|
POSTGRES_USER: ${POSTGRES_USER:-eppp}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-eppp}
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
# Health gate for the app service (T02): probe the same credentials the db
|
|
# service was created with. `$$` defers interpolation to the container, so
|
|
# POSTGRES_USER/POSTGRES_DB overrides apply to the probe too.
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 5s
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/server/Dockerfile
|
|
environment:
|
|
DATABASE_URL: postgres://eppp:eppp@db:5432/eppp
|
|
ports:
|
|
- "${APP_PORT:-3000}:3000"
|
|
# T02: start only once the database reports healthy (service_healthy), so
|
|
# the application waits for PostgreSQL before starting.
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|