---
services:

  lint-and-test:
    platform: linux/amd64
    build:
      context: .
      target: lint-and-test
    volumes:
      - ./build:/var/app/build
    environment:
      - Environment=test

  masters-registry-dev:
    platform: linux/amd64
    build:
      context: .
      target: dev
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    ports:
      - "8888:5000"
    volumes:
      - ./masters_registry:/var/app/masters_registry

    env_file:
      - path: .env
        required: false
    environment:
      - Environment=dev
      - AR_DB_URL=mysql+pymysql://root:root@mysql:3306/masters_registry
      - BULK_STATUSES_DB_URL=mysql+pymysql://root:root@mysql:3306/masters_registry
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
      - BROKER_URL=redis://redis:6379/0

  masters-registry-deploy:
    platform: linux/amd64
    build:
      context: .
      target: deploy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    ports:
      - "8889:8080"
    env_file:
      - path: .env
        required: false
    environment:
      - DATADOG_TRACE_ENABLED=false
      - Environment=dev

  mysql:
      image: mysql:5.7
      environment:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: masters_registry
          MYSQL_USER: root
          MYSQL_PASSWORD: root
      ports:
          - "3306:3306"
      volumes:
          - ./masters_registry:/var/lib/mysql

  redis:
    image: redis:6.0.9
    ports:
      - "6379:6379"
    volumes:
      - ./masters_registry:/var/lib/redis