version: '3'
services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-container
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./server/nginx/certs:/etc/nginx/certs
    links:
      - node-server:node-server

  node-server:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - JSPM_GITHUB_AUTH_TOKEN=$JSPM_GITHUB_AUTH_TOKEN
    container_name: node-container
    ports:
      - 8080:8080
    volumes:
      - .:/home/whalephant
      - nodemodules_app:/home/whalephant/app/node_modules
      - jspm_packages_app:/home/whalephant/app/jspm_packages
      - github_packages_app:/home/whalephant/app/jspm_packages/github
      - npm_packages_app:/home/whalephant/app/jspm_packages/npm
    environment:
      - VIRTUAL_HOST=docker.nginx.node.com
      - VIRTUAL_PORT=8080

volumes:
  nodemodules_server:
  nodemodules_app:
  jspm_packages_app:
  github_packages_app:
  npm_packages_app: