services:
  db:
    image: postgis/postgis:16-3.4
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    ports:
      - "5432:5432"
    volumes:
      - db_data:/var/lib/postgresql/data

  redis:
    image: redis:7
    ports:
      - "6379:6379"

  api:
    build: ./services/api
    volumes:
      - media_data:/data/media
    env_file: .env
    depends_on:
      - db
      - redis
    ports:
      - "8000:8000"

  worker:
    build: ./services/worker
    volumes:
      - media_data:/data/media
    env_file: .env
    depends_on:
      - api
      - redis
      - db

  beat:
    build: ./services/worker
    env_file: .env
    depends_on:
      - redis
      - db
    volumes:
      - media_data:/data/media
    command: ["celery","-A","app.celery_app","beat","--loglevel=INFO"]

  web:
    build: ./apps/web
    env_file: .env
    depends_on:
      - api
    ports:
      - "3000:3000"

volumes:
  db_data:
