version: '3.8'

services:
  # Main application
  app:
    build: .
    ports:
      - "${PORT:-3000}:${PORT:-3000}"
    env_file:
      - .env
    environment:
      - MIGRATION_SQL_HOST=${MIGRATION_SQL_HOST:-host.docker.internal}
      - MIGRATION_SQL_PORT=${MIGRATION_SQL_PORT:-3306}
      - MIGRATION_SQL_DATABASE=${MIGRATION_SQL_DATABASE:-otti_migration}
      - MIGRATION_SQL_USER=${MIGRATION_SQL_USER:-root}
      - MIGRATION_SQL_PASSWORD=${MIGRATION_SQL_PASSWORD:-password}
      # Logging configuration
      - LOG_LEVEL=${LOG_LEVEL:-debug}
      - GOOGLE_CLOUD_PROJECT_ID=${GOOGLE_CLOUD_PROJECT_ID}
      - GOOGLE_CLOUD_KEY_FILE=${GOOGLE_CLOUD_KEY_FILE}
      - GOOGLE_CLOUD_LOG_NAME=${GOOGLE_CLOUD_LOG_NAME:-otti-api}
    volumes:
      - ./uploads:/app/uploads
      - ./logs:/app/logs
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    networks:
      - otti-network
    extra_hosts:
      - "host.docker.internal:host-gateway"

networks:
  otti-network:
    driver: bridge 