version: '2'

services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy:latest
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - dhparam:/etc/nginx/dhparam
      - certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nginx-proxy-le
    depends_on:
      - "nginx-proxy"
    volumes_from:
      - nginx-proxy
    volumes:
      - certs:/etc/nginx/certs:rw
      - acme:/etc/acme.sh
      - /var/run/docker.sock:/var/run/docker.sock:ro

networks:
  proxy-tier:
    external:
      name: nginx-proxy
volumes:
  conf:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/conf'
  vhost:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/vhost'
  html:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/html'
  dhparam:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/dhparam'
  certs:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/certs'
  acme:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/volumes/letsencrypt/acme'
