version: '3.9'
services:
  dev:
    build:
      context: .
      target: dev
      secrets:
        - github_npm_token
    ports:
      - '8080:8080'
    environment:
      - ENV=qa
      - NODE_ENV=development
      - LOG_LEVEL=debug
      - DD_TRACE_ENABLED=false
      - APOLLO_INTROSPECTION=true
      - APOLLO_PLAYGROUND=true
      - OPENSEARCH_URL
      - OPENSEARCH_INDEX
      - OPENSEARCH_INDEX_ALIAS
      - ENABLE_JWT_SERVICE_CACHE=false
      - OWS_PRODUCT_REVIEW_URL=https://qa-ows-product-review.theorchard.io/
      - GITHUB_NPM_TOKEN=/run/secrets/github_npm_token
      - SPLIT_API_KEY
  lint-and-test:
    build:
      context: .
      target: lint-and-test
      secrets:
        - github_npm_token
    environment:
      - NODE_ENV=development
      - ENV=test
      - GITHUB_NPM_TOKEN=/run/secrets/github_npm_token
  integration-tests:
    build:
      context: .
      target: integration-tests
      secrets:
        - github_npm_token
    environment:
      - NODE_ENV=development
      - ENV=test
      - BASE_URL
      - GITHUB_NPM_TOKEN=/run/secrets/github_npm_token
  deploy:
    build:
      context: .
      target: deploy
      secrets:
        - github_npm_token
    container_name: graphql-content-review
    logging:
      options:
        max-size: '1m'
        max-file: '1'
    environment:
      - NODE_ENV=development
      - ENV=dev
      - LOG_LEVEL=info
      - DD_TRACE_ENABLED=false # Prevent datadog tracing
      - APOLLO_INTROSPECTION=true # Enable apollo features
      - APOLLO_PLAYGROUND=true # Enable apollo features
      - ENABLE_JWT_SERVICE_CACHE=false # Prevent JWT handling
      - OPENSEARCH_URL
      - OPENSEARCH_INDEX
      - OPENSEARCH_INDEX_ALIAS
      - SENTRY_DSN
      - OWS_PRODUCT_REVIEW_URL=https://qa-ows-product-review.theorchard.io/
      - GITHUB_NPM_TOKEN=/run/secrets/github_npm_token
      - SPLIT_API_KEY
    ports:
      - '8080:8080'
secrets:
  github_npm_token:
    environment: GITHUB_NPM_TOKEN
