18F/e-QIP-prototype

View on GitHub
docker-compose.yml

Summary

Maintainability
Test Coverage
# intended for local development

version: '2'

services:
  db:
    image: postgres:9.6.5
    volumes:
      - ./conf/postgres-configure.sh:/docker-entrypoint-initdb.d/postgres-configure.sh
      - ./conf/postgres.conf:/srv/postgresql.conf
      - ./api/eapp.crt:/srv/server.crt
      - ./api/eapp.key:/srv/server.key
    ports:
      - '5432:5432'
    networks:
      - eapp

  # Within the docker world this is the main entrypoint in to
  # this web application. This was done in order to have a
  # combination of:
  #  - development REPL
  #  - automated unit tests
  #  - spec testing
  #
  # The web server will do the following:
  #  - serve compiled static assets
  #  - proxy /api requests to the backend API
  web:
    image: nginx:alpine
    env_file:
      - .env
    command: /usr/src/nginx.sh
    volumes:
      - ./bin/nginx.sh:/usr/src/nginx.sh
      - ./conf/ssl:/etc/ssl
      - ./conf/nginx.template.conf:/tmp/nginx.template.conf
      - ./dist:/usr/share/nginx/html
    ports:
      - '8080:8080'
      - '8443:8443'
    networks:
      - eapp

  js:
    build:
      context: .
      dockerfile: conf/docker/Dockerfile.frontend
    env_file:
      - .env
    command: yarn watch-js
    volumes:
      - .:/usr/src/app
      # ensure node_modules aren't shared with host system
      # https://michalzalecki.com/docker-compose-for-nodejs-and-postresql/#docker-compose
      - /usr/src/app/node_modules
    networks:
      - eapp

  api:
    build:
      context: .
      dockerfile: conf/docker/Dockerfile.api
    env_file:
      - .env
    command: ./bin/live_reload.sh
    volumes:
      - .:/go/src/github.com/18F/e-QIP-prototype
      - /go/src/github.com/18F/e-QIP-prototype/api/vendor
    ports:
      - 3000:3000
    environment:
      DATABASE_USER: postgres
      DATABASE_NAME: postgres
      DATABASE_HOST: db:5432
    networks:
      - eapp
    depends_on:
      - db

networks:
  eapp:
    driver: bridge