services:
    integration:
        build:
            context: .
            target: integration
        environment:
            - 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
            - DD_ENV=${DD_ENV:-qa}
            - DD_SERVICE=ows-project-manager-integration-tests
            - DD_VERSION=${DD_VERSION:-local}
            - DD_SITE=${DD_SITE:-sonymusic-pde.datadoghq.com}
            - DD_AGENT_HOST=host-gateway
            - DD_GIT_REPOSITORY_URL
            - DD_GIT_COMMIT_SHA
            - DD_GIT_BRANCH
            - DD_GIT_COMMIT_AUTHOR_NAME
            - DD_GIT_COMMIT_AUTHOR_EMAIL
            - DD_GIT_COMMIT_MESSAGE
            - JOB_NAME=${JOB_NAME:-}
            - BUILD_NUMBER=${BUILD_NUMBER:-}
            - BUILD_ID=${BUILD_ID:-}
            - JENKINS_URL=${JENKINS_URL:-}
            - BUILD_URL=${BUILD_URL:-}
        extra_hosts:
            - "host-gateway:host-gateway"
    unit-lint:
        build:
            context: .
            target: unit-lint
        volumes:
            - .:/var/app
    dev:
        build:
            context: .
            target: dev
        env_file:
            - path: .env
              required: false
        environment:
            - Environment=dev
            - DD_TRACE_ENABLED=false
        volumes:
            - ./:/var/app
        ports:
            - "5000:5000"
        healthcheck:
            test: ["CMD", "curl", "-f", "http://localhost:5000/hello"]
            interval: 1m30s
            timeout: 10s
            retries: 3
            start_period: 40s

    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
