services:
  postgres:
    image: postgres:17-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-fable}
      POSTGRES_USER: ${POSTGRES_USER:-fable}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-fable_dev_password}
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./database/migrations:/docker-entrypoint-initdb.d:ro

  gateway:
    build:
      context: .
      dockerfile: apps/gateway/Dockerfile
    environment:
      GATEWAY_PORT: 3000
      CORS_ORIGIN: "*"
      AUTH_SERVICE_URL: http://auth-service:8080
      USER_SERVICE_URL: http://user-service:8080
      CONTENT_SERVICE_URL: http://content-service:8080
      TAXONOMY_SERVICE_URL: http://taxonomy-service:8080
      SPEAKER_SERVICE_URL: http://speaker-service:8080
      SUBSCRIPTION_SERVICE_URL: http://subscription-service:8080
      NOTIFICATION_SERVICE_URL: http://notification-service:8080
      COMMENT_SERVICE_URL: http://comment-service:8080
      SEARCH_SERVICE_URL: http://search-service:8080
      ANALYTICS_SERVICE_URL: http://analytics-service:8080
      AUDIT_SERVICE_URL: http://audit-service:8080
      MEDIA_SERVICE_URL: http://media-service:8080
    ports:
      - "3000:3000"
    depends_on:
      - auth-service
      - user-service
      - content-service
      - taxonomy-service
      - speaker-service
      - subscription-service
      - notification-service
      - comment-service
      - search-service
      - analytics-service
      - audit-service
      - media-service

  web:
    build:
      context: .
      dockerfile: apps/web/Dockerfile
    ports:
      - "5173:80"
    depends_on:
      - gateway

  auth-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: auth
    environment:
      PORT: 8080

  user-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: user
    environment:
      PORT: 8080

  content-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: content
    environment:
      PORT: 8080

  taxonomy-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: taxonomy
    environment:
      PORT: 8080

  speaker-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: speaker
    environment:
      PORT: 8080

  subscription-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: subscription
    environment:
      PORT: 8080

  notification-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: notification
    environment:
      PORT: 8080

  comment-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: comment
    environment:
      PORT: 8080

  search-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: search
    environment:
      PORT: 8080

  analytics-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: analytics
    environment:
      PORT: 8080

  audit-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: audit
    environment:
      PORT: 8080

  media-service:
    build:
      context: .
      dockerfile: infra/docker/go-service.Dockerfile
      args:
        SERVICE: media
    environment:
      PORT: 8080

volumes:
  postgres_data:
