From a night of researching and playing around with a simple node container and how to get a docker-compose.yml configuration to launch it behind an nginx proxy and get Let's Encrypt certificates.
Created
March 17, 2017 10:35
-
-
Save RyanHirsch/504e0806a7dad4d34f79dfa8c1954b36 to your computer and use it in GitHub Desktop.
Automagic nginx configuration and let's encrypt certificates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| services: | |
| api: | |
| restart: always | |
| image: ryanhirsch/express-hello | |
| container_name: hello-api | |
| environment: | |
| - VIRTUAL_HOST=hello.hirsch.io | |
| - VIRTUAL_NETWORK=nginx-proxy | |
| - VIRTUAL_PORT=3000 | |
| - LETSENCRYPT_HOST=hello.hirsch.io | |
| - [email protected] | |
| nginx: | |
| restart: always | |
| image: nginx | |
| container_name: nginx | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - "/etc/nginx/conf.d" | |
| - "/etc/nginx/vhost.d" | |
| - "/usr/share/nginx/html" | |
| - "./volumes/proxy/certs:/etc/nginx/certs:ro" | |
| nginx-gen: | |
| restart: always | |
| image: jwilder/docker-gen | |
| container_name: nginx-gen | |
| volumes: | |
| - "/var/run/docker.sock:/tmp/docker.sock:ro" | |
| - "./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro" | |
| volumes_from: | |
| - nginx | |
| entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | |
| letsencrypt-nginx-proxy-companion: | |
| restart: always | |
| image: jrcs/letsencrypt-nginx-proxy-companion | |
| container_name: letsencrypt-nginx-proxy-companion | |
| volumes_from: | |
| - nginx | |
| volumes: | |
| - "/var/run/docker.sock:/var/run/docker.sock:ro" | |
| - "./volumes/proxy/certs:/etc/nginx/certs:rw" | |
| environment: | |
| - NGINX_DOCKER_GEN_CONTAINER=nginx-gen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment