services:
  unit-lint:
    build:
      dockerfile: Dockerfile
      context: .
      target: unit-lint
    volumes:
      - .:/var/app

  bff-promo-player-dev:
    build:
      context: .
      target: dev
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    ports:
      - "5000:5000"
    volumes:
      - .:/var/app
    env_file:
      - path: .env
        required: false
    environment:
      - Environment=dev

  bff-promo-player:
    build:
      dockerfile: Dockerfile
      context: .
      target: deploy
    ports:
      - "8080:8080"
    healthcheck:
      test:
        ["CMD-SHELL", "curl", "-f", "http://localhost:8080/hello/ || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 5
    environment:
      Environment: "local"
      AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}"
      AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}"
      AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN}"
      AWS_DEFAULT_REGION: "us-east-1"
      DATADOG_ENV: "dev-bff-promo-player"
      DD_LOGS_INJECTION: "true"
      DD_AGENT_HOST: "datadog"
      CDN_URL: "https://qa-cdn.theorchard.io"
      S3_MANIFEST_URL: "https://qa-cdn.theorchard.io/shared/manifest"
    volumes:
      - .:/var/app

  datadog:
    links:
      - bff-promo-player
    image: gcr.io/datadoghq/agent:latest
    environment:
      DD_API_KEY: "${DD_API_KEY}"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /proc/:/host/proc/:ro
      - /sys/fs/cgroup:/host/sys/fs/cgroup:ro

  integration-test:
    build:
      context: .
      target: integration-test
    volumes:
      - .:/var/app
