Skip to content

Instantly share code, notes, and snippets.

@mattsnowboard
Created October 16, 2018 05:23
Show Gist options
  • Save mattsnowboard/55b22bbc6b167a8936f036ed78e64601 to your computer and use it in GitHub Desktop.
Save mattsnowboard/55b22bbc6b167a8936f036ed78e64601 to your computer and use it in GitHub Desktop.
docker-compose.yml
---
version: '3'
services:
# Containers for general management/common tasks
nginx:
image: nginx
container_name: nginx
restart: on-failure
ports:
- "80:80"
- "443:443"
volumes:
- nginx-conf:/etc/nginx/conf.d
- nginx-vhost:/etc/nginx/vhost.d
- nginx-certs:/etc/nginx/certs:ro
- nginx-html:/usr/share/nginx/html
environment:
- PUID=${PUID}
- PGID=${PGID}
dockergen:
image: jwilder/docker-gen
container_name: dockergen
network_mode: "host"
restart: on-failure
command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- nginx-conf:/etc/nginx/conf.d
- /var/run/docker.sock:/tmp/docker.sock:ro
- /opt/docker/docker-gen/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl
environment:
- PUID=${PUID}
- PGID=${PGID}
letsencrypt-nginx-proxy:
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt
restart: on-failure
depends_on:
- nginx
- dockergen
volumes:
- nginx-conf:/etc/nginx/conf.d
- nginx-vhost:/etc/nginx/vhost.d
- nginx-certs:/etc/nginx/certs
- nginx-html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- NGINX_DOCKER_GEN_CONTAINER=dockergen
- NGINX_PROXY_CONTAINER=nginx
- DEBUG=true
- PUID=${PUID}
- PGID=${PGID}
# Home Assistant Home Automation
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant
network_mode: "host"
# ports:
# - "8123:8123"
expose:
- 8123
volumes:
- /opt/docker/homeassistant:/config
- /etc/localtime:/etc/localtime:ro
devices:
- /dev/zwave:/dev/zwave:rwmZ
restart: on-failure
environment:
- VIRTUAL_HOST=ha.MYDOMAIN
- VIRTUAL_PORT=8123
- LETSENCRYPT_HOST=ha.MYDOMAIN
- LETSENCRYPT_EMAIL=example@gmail.com
- LETSENCRYPT_TEST=true
- PUID=${PUID}
- PGID=${PGID}
volumes:
nginx-conf:
driver_opts:
type: 'none'
o: 'bind'
device: '/opt/docker/nginx/conf.d'
nginx-vhost:
driver_opts:
type: 'none'
o: 'bind'
device: '/opt/docker/nginx/vhost.d'
nginx-certs:
driver_opts:
type: 'none'
o: 'bind'
device: '/opt/docker/nginx/certs'
nginx-html:
driver_opts:
type: 'none'
o: 'bind'
device: '/opt/docker/nginx/html'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment