services:
  postgres:
    image: postgres:17
    container_name: dzentra_postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: dzentra_bot
      POSTGRES_USER: dzentra_bot
      POSTGRES_PASSWORD: change_me
    ports:
      - "5432:5432"
    volumes:
      - dzentra_postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U dzentra_bot -d dzentra_bot"]
      interval: 5s
      timeout: 3s
      retries: 10

  bot:
    build:
      context: ../..
      dockerfile: infra/docker/Dockerfile
    container_name: dzentra_bot
    restart: unless-stopped
    env_file:
      - ../../app/.env
    depends_on:
      postgres:
        condition: service_healthy

volumes:
  dzentra_postgres_data: