📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Docker Full-Stack Compose

Full-Stack Compose

5 min read
Full-stack Compose with frontend, backend, PostgreSQL, Redis, and a background worker service.

Full-Stack Compose

services:
  frontend:
    build: ./frontend
    ports: ["3000:3000"]

  backend:
    build: ./backend
    environment:
      DATABASE_URL: postgresql://user:pass@db/mydb
      REDIS_URL: redis://cache:6379
    depends_on:
      db:    { condition: service_healthy }
      cache: { condition: service_started }

  db:
    image: postgres:16
    volumes: [pgdata:/var/lib/postgresql/data]
    healthcheck:
      test: ["CMD", "pg_isready"]
      interval: 5s

  cache:
    image: redis:alpine

  worker:
    build: ./backend
    command: python worker.py
    depends_on: [db, cache]

volumes:
  pgdata: