Skip to content

Instantly share code, notes, and snippets.

@Saanch
Created October 7, 2017 11:44
Show Gist options
  • Save Saanch/47d3d6ccba6c22e3d7b3c71c01d1243c to your computer and use it in GitHub Desktop.
Save Saanch/47d3d6ccba6c22e3d7b3c71c01d1243c to your computer and use it in GitHub Desktop.

Revisions

  1. Sanu Sathyaseelan created this gist Oct 7, 2017.
    47 changes: 47 additions & 0 deletions nginx.docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    version: '3'
    services:
    nginx:
    image: nginx
    container_name: nginx
    ports:
    - '80:80'
    - '443:443'
    volumes:
    - 'nginx-config:/etc/nginx/conf.d'
    - 'nginx-certs:/etc/nginx/certs'
    - 'nginx-vhosts:/etc/nginx/vhost.d'
    - 'nginx-webroot:/usr/share/nginx/html'

    dockergen:
    image: jwilder/docker-gen
    container_name: nginx-docker-gen
    command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
    volumes:
    - 'nginx-config:/etc/nginx/conf.d'
    - 'nginx-certs:/etc/nginx/certs'
    - 'nginx-vhosts:/etc/nginx/vhost.d'
    - 'nginx-webroot:/usr/share/nginx/html'
    - '/var/run/docker.sock:/tmp/docker.sock:ro'
    - './nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl'

    letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    environment:
    NGINX_DOCKER_GEN_CONTAINER: nginx-docker-gen
    volumes:
    - 'nginx-config:/etc/nginx/conf.d'
    - 'nginx-certs:/etc/nginx/certs'
    - 'nginx-vhosts:/etc/nginx/vhost.d'
    - 'nginx-webroot:/usr/share/nginx/html'
    - '/var/run/docker.sock:/var/run/docker.sock:ro'

    volumes:
    nginx-config:
    nginx-certs:
    nginx-vhosts:
    nginx-webroot:

    networks:
    default:
    external:
    name: nginx-proxy