version: '3.8'

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www/html
    environment:
      - DB_HOST=db
      - DB_NAME=sirat_db
      - DB_USER=sirat_user
      - DB_PASSWORD=sirat_pass
      - GEMINI_API_KEY=${GEMINI_API_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    depends_on:
      - db

  db:
    image: postgres:15-alpine
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    environment:
      - POSTGRES_DB=sirat_db
      - POSTGRES_USER=sirat_user
      - POSTGRES_PASSWORD=sirat_pass

volumes:
  pgdata:
