version: "3.9"

services:
  api:
    image: python:3.12-slim
    working_dir: /app
    volumes:
      - ..:/app
    command: bash -lc "pip install -r requirements.txt && uvicorn backend.app:app --host 0.0.0.0 --port 8000"
    environment:
      - DATABASE_URL=postgresql+psycopg2://postgres:postgres@db:5432/punimtag
      - PYTHONUNBUFFERED=1
    ports:
      - "8000:8000"
    depends_on:
      - db
      - redis

  worker:
    image: python:3.12-slim
    working_dir: /app
    volumes:
      - ..:/app
    command: bash -lc "pip install -r requirements.txt && python -m backend.worker"
    environment:
      - DATABASE_URL=postgresql+psycopg2://postgres:postgres@db:5432/punimtag
      - PYTHONUNBUFFERED=1
    depends_on:
      - db
      - redis

  db:
    image: postgres:16
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_DB=punimtag
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data

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

volumes:
  pgdata:


