18F/cg-dashboard

View on GitHub
docker-compose.yml

Summary

Maintainability
Test Coverage
version: '2.1'
services:
  app:
    extends: backend
    working_dir: /go/src/github.com/18F/cg-dashboard
    entrypoint: ./devtools/golang/install_deps_then "go run server.go"
    depends_on:
      mail:
        condition: service_started
      frontend:
        condition: service_healthy
    ports:
      - "8002:8002"
    networks:
      - servicesNetwork
    environment:
      CONSOLE_API_URL: https://api.local.pcfdev.io
      CONSOLE_HOSTNAME: http://localhost:8002
      CONSOLE_LOGIN_URL: https://uaa.local.pcfdev.io
      CONSOLE_LOG_URL: https://loggregator.local.pcfdev.io
      CONSOLE_UAA_URL: https://uaa.local.pcfdev.io
      LOCAL_CF: "1"
      PORT: 8002
      VCAP_APPLICATION: '{}'
      VCAP_SERVICES: >
        {
          "user-provided": [{
            "credentials": {
               "CONSOLE_CLIENT_ID": "dashboard-local",
               "CONSOLE_CLIENT_SECRET": "notarealsecret",
               "CSRF_KEY": "00112233445566778899aabbccddeeff",
               "SESSION_AUTHENTICATION_KEY": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
               "SESSION_ENCRYPTION_KEY": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff",
               "SMTP_FROM": "no-reply@cloud.gov",
               "SMTP_HOST": "smtp.fake.com",
               "SMTP_PASS": "",
               "SMTP_PORT": "25",
               "SMTP_USER": ""
            },
            "name": "dashboard-ups",
            "label": "user-provided"
          }]
        }
  mail:
    image: tophfr/mailcatcher
    ports:
      - 8025:80 # for the web UI
    networks:
      servicesNetwork:
        aliases:
          - smtp.fake.com
  frontend_dev_tools:
    build:
      context: .
      dockerfile: ./devtools/node/Dockerfile
    working_dir: /cg-dashboard
    # override the current entrypoint from the base image.
    entrypoint: /cg-dashboard/devtools/node/install_deps_then
    volumes:
      - global-node-modules:/usr/local/lib/node_modules
      - npm-cache:/root/.npm
      - node-modules:/cg-dashboard/node_modules
      - .:/cg-dashboard
      #- ./node_modules:/cg-dashboard/node_modules
      - cg-style-node-modules:/cg-style/node_modules
      - ${CG_STYLE_PATH-../cg-style}:/cg-style
      - frontend-home:/headless
    environment:
      - CG_DASHBOARD_DIR=/cg-dashboard
      - CG_STYLE_DIR=/cg-style
  frontend:
    extends:
      service: frontend_dev_tools
    command: 'sleep 100d'
    ports:
      - "5901:5901"
      - "6901:6901"
    healthcheck:
      test: ["CMD", "wget", "http://localhost:6901"]
      interval: 1m00s
      timeout: 10s
      retries: 20
    environment:
      - START_VNC=1
    depends_on:
      frontend_cleanup:
        condition: service_started
  watch:
    extends:
      service: frontend_dev_tools
    command: 'npm run watch'
    working_dir: /cg-dashboard
    depends_on:
      frontend:
        condition: service_healthy
  watch_cg_style:
    extends:
      service: frontend_dev_tools
    working_dir: /cg-style
    command: 'npm run watch'
    depends_on:
      frontend:
        condition: service_healthy
    environment:
      - CG_STYLE=1
  frontend_cleanup:
    extends:
      service: frontend_dev_tools
    working_dir: /cg-dashboard
    command: 'node devtools/node/cleanup.js'
  backend:
    image: golang:1.9.2
    environment:
      - GOPATH=/go
      - DOCKER_IN_DOCKER=1
    volumes:
      - .:/go/src/github.com/18F/cg-dashboard
      - go-bins:/go/bin/
      - go-dep-tool-src:/go/src/github.com/golang
      # needed for running go tests that use https://github.com/ory/dockertest
      - /var/run/docker.sock:/var/run/docker.sock
    working_dir: /go/src/github.com/18F/cg-dashboard
    entrypoint: ./devtools/golang/install_deps_then
    networks:
      - servicesTestNetwork
  frontend_testing_server:
    extends:
      service: frontend_dev_tools
    command: 'npm run testing-server'
    working_dir: /cg-dashboard
    ports:
      - "8001:8001"
volumes:
  node-modules:
  cg-style-node-modules:
  npm-cache:
  global-node-modules:
  go-bins:
  go-dep-tool-src:
  frontend-home:

networks:
  servicesNetwork:
    driver: bridge
  # needed for running go tests that use https://github.com/ory/dockertest
  servicesTestNetwork:
    driver: bridge