Docker Compose Dev Stack

by Seamus March 12, 2026 Public
80 views Raw Download Revisions (v1)

Revision History

No revision history recorded yet.

docker-compose.yml yaml Raw
version: '3.9'

services:
  app:
    build: .
    ports:
      - "8000:8000"
    volumes:
      - .:/app
    environment:
      DATABASE_URL: postgres://user:pass@db:5432/appdb
      REDIS_URL: redis://cache:6379/0
    depends_on:
      db:
        condition: service_healthy
      cache:
        condition: service_started

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: appdb
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user -d appdb"]
      interval: 5s
      retries: 5

  cache:
    image: redis:7-alpine
    command: redis-server --save "" --appendonly no

volumes:
  pgdata:
Skip to toolbar