version: "3.8"
services:
  app:
    image: example/app:latest
    ports:
      - "8080:8080"
    environment:
      DATABASE_URL: postgres://db:5432/app
      REDIS_URL: redis://cache:6379
      LOG_LEVEL: info
    depends_on:
      - db
      - cache
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/healthz"]
      interval: 30s
      timeout: 5s
      retries: 3
  db:
    image: postgres:15
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: example
      POSTGRES_DB: app
    ports:
      - "5432:5432"
  cache:
    image: redis:7
    ports:
      - "6379:6379"
volumes:
  db_data:
networks:
  default:
    name: example_network
