Infra & Cloud yaml Intermediate

Docker Compose for Local Dev Stack

Full local dev stack: app, Postgres, Redis, and MailHog in one Compose file.

yaml
services:
  app:
    build: .
    ports: ["8000:8000"]
    environment:
      DATABASE_URL: postgres://dev:dev@db:5432/dev
      REDIS_URL: redis://cache:6379/0
    depends_on: [db, cache]
  db:
    image: postgres:16-alpine
    environment: { POSTGRES_USER: dev, POSTGRES_PASSWORD: dev, POSTGRES_DB: dev }
    volumes: [pgdata:/var/lib/postgresql/data]
  cache:
    image: redis:7-alpine
  mail:
    image: mailhog/mailhog
    ports: ["8025:8025"]
volumes:
  pgdata:

Prerequisites

  • Docker Compose v2+

Pro Tips

  • → Add a .env file and reference with env_file: .env.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
yaml
Level
Intermediate
Read time
3 min
Published
Dec 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.