Docker Compose for a Production-Like Local Stack
Postgres, Redis, Kafka, and the gateway — one command for new engineers to get a working environment.
New engineers used to spend half a day wiring local dependencies. Compose fixed that.
Stack
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: gateway
POSTGRES_PASSWORD: dev
ports: ["5432:5432"]
volumes: ["pgdata:/var/lib/postgresql/data"]
redis:
image: redis:7-alpine
ports: ["6379:6379"]
gateway:
build: .
depends_on: [postgres, redis]
environment:
ConnectionStrings__Default: "Host=postgres;Database=gateway;Password=dev"
Redis__Host: redis
ports: ["8080:8080"]
volumes:
pgdata:
Rules We Enforce
- No
latesttags in compose files checked into git - Seed data via init scripts in
./docker/init, not manual SQL - Healthchecks on postgres before gateway starts (
depends_on+ condition)
Onboarding time: 4 hours → 20 minutes.
docker-compose , local-dev , dx · Docker , PostgreSQL , Redis