CMSgov/dpc-app

View on GitHub
docker-compose.yml

Summary

Maintainability
Test Coverage
version: '3'

services:

  db:
    image: postgres:11
    command: postgres -c 'max_connections=250'
    environment:
      - POSTGRES_MULTIPLE_DATABASES=dpc_attribution,dpc_queue,dpc_auth,dpc_consent,dpc-website_development,bcda,dpc-portal_development
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=dpc-safe
    volumes:
      # Mount database startup script, which automatically creates new databases
      # based on the POSTGRES_MULTIPLE_DATABASES variable above.
      - ./docker/postgres:/docker-entrypoint-initdb.d
      # Mount persistent volume to ensure data is not erased across containers.
      - pgdata:/var/lib/postgresql/data

  aggregation:
    image: ${ECR_HOST:-755619740999.dkr.ecr.us-east-1.amazonaws.com/dpc-aggregation}:latest
    ports:
      - "9901:9900"
    env_file:
      - ./ops/config/decrypted/local.env
    environment:
      - ENV=local
      - USE_BFD_MOCK=${USE_BFD_MOCK:-true}
      - JACOCO=${REPORT_COVERAGE}
      - DEBUG_MODE=${DEBUG_MODE:-false}
    depends_on:
      - db
      - consent
    volumes:
      - export-volume:/app/data
      - ./jacocoReport/dpc-aggregation:/jacoco-report

  attribution:
    image: ${ECR_HOST:-755619740999.dkr.ecr.us-east-1.amazonaws.com/dpc-attribution}:latest
    depends_on:
      - db
    environment:
      - ENV=local
      - JACOCO=${REPORT_COVERAGE}
      - DEBUG_MODE=${DEBUG_MODE:-false}
    ports:
      - "3500:8080"
      - "9902:9900"
    volumes:
      - ./jacocoReport/dpc-attribution:/jacoco-report

  api:
    image: ${ECR_HOST:-755619740999.dkr.ecr.us-east-1.amazonaws.com/dpc-api}:latest
    ports:
      - "3002:3002"
      - "9903:9900"
    env_file:
      - ./ops/config/decrypted/local.env
    environment:
      - ATTRIBUTION_URL=http://attribution:8080/v1/
      - ENV=local
      - JACOCO=${REPORT_COVERAGE}
      - EXPORT_PATH=/app/data
      - AUTH_DISABLED=${AUTH_DISABLED:-false}
      - DEBUG_MODE=${DEBUG_MODE:-false}
    depends_on:
      - attribution
    volumes:
      - export-volume:/app/data
      - ./jacocoReport/dpc-api:/jacoco-report

  consent:
    image: ${ECR_HOST:-755619740999.dkr.ecr.us-east-1.amazonaws.com/dpc-consent}:latest
    depends_on:
      - db
    environment:
      - ENV=local
      - JACOCO=${REPORT_COVERAGE}
      - DEBUG_MODE=${DEBUG_MODE:-false}
    ports:
      - "3600:3600"
      - "9004:9900"
    volumes:
      - ./jacocoReport/dpc-consent:/jacoco-report

  start_core_dependencies:
    image: dadarek/wait-for-dependencies
    depends_on:
      - db
    command: db:5432

  start_api_dependencies:
    image: dadarek/wait-for-dependencies
    depends_on:
      - attribution
      - aggregation
    command: attribution:8080 aggregation:9900

  start_api:
    image: dadarek/wait-for-dependencies
    depends_on:
      - api
    command: api:3002

  start_consent:
    image: dadarek/wait-for-dependencies
    depends_on:
      - consent
    command: consent:3600

  tests:
    image: maven:3.6-jdk-11
    env_file:
      - ./ops/config/decrypted/local.env
    volumes:
      - export-volume:/tmp
      - ./:/usr/src/mymaven
    working_dir: /usr/src/mymaven
    command: sh -c "mvn test -Pintegration-tests -am -ntp"
    network_mode: host

volumes:
  pgdata:
  export-volume:
    driver: local
    driver_opts:
      type: none
      device: /tmp
      o: bind