services:
  update_composer_lockfile:
    platform: linux/amd64
    build:
      context: .
      dockerfile: Dockerfile
      target: composer_update
    secrets:
      - github_auth
    volumes:
      - ./composer.lock:/var/www/html/composer.lock

  bulkupload:
    platform: linux/amd64
    build:
      context: .
      dockerfile: Dockerfile
      target: deploy
      secrets:
        - github_auth
    ports:
      - "8080:80"
    environment:
      - APPLICATION_ENV=${APPLICATION_ENV}
      - ENVIRONMENT=${ENVIRONMENT}
      - PHP_DISPLAY_ERRORS=${PHP_DISPLAY_ERRORS}
      - SENTRY_DSN=${SENTRY_DSN}
      - AWS_ACCESS_KEY_ID
      - AWS_SECRET_ACCESS_KEY
      - AWS_SESSION_TOKEN
      - AWS_REGION
    volumes:
      - ./src:/var/www/html/src
      - ./healthchk.php:/var/www/html/healthchk.php
      - ./htmlupload.php:/var/www/html/htmlupload.php

  lint-and-test:
    platform: linux/amd64
    build:
      context: .
      dockerfile: Dockerfile
      target: tests
      secrets:
        - github_auth
    volumes:
      - ./build:/var/www/html/build

secrets:
  github_auth:
    environment: GITHUB_AUTH
