services:
  dev:
    build:
      context: .
      target: dev
    ports:
      - "5000:5000"
    environment:
      - Environment=dev
      - AR_MYSQL_DATABASE
      - AR_MYSQL_HOST
      - AR_MYSQL_PASSWORD
      - AR_MYSQL_USER
      - OWS_ACCOUNT_URL
    volumes:
      - .:/var/app

  integration-test:
    build:
      context: .
      target: integration-test
    environment:
      - QA_DB_PASS=${QA_DB_PASS}
      - DB_CLIENT_PASS=${DB_CLIENT_PASS}
    volumes:
      - .:/var/app
    env_file:
      - path: "./.env"
        required: false

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

  deploy:
    build:
      context: .
      target: deploy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/hello/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s

  update-lockfile:
    platform: linux/amd64
    build:
      context: .
      target: update-lockfile
    volumes:
      - ./poetry.lock:/var/app/poetry.lock
