diff options
-rw-r--r-- | docker-compose-acme.yml | 55 | ||||
-rw-r--r-- | docker-compose.yml | 48 |
2 files changed, 72 insertions, 31 deletions
diff --git a/docker-compose-acme.yml b/docker-compose-acme.yml new file mode 100644 index 0000000..51ce003 --- /dev/null +++ b/docker-compose-acme.yml @@ -0,0 +1,55 @@ +# Provides reverse HTTP proxy service, including TLS termination and automated +# certificate management via Lets Encrypt. To create a Docker container that +# uses this service: +# +# - Define environment variables: +# - VIRTUAL_HOST=<domain name> +# - LETSENCRYPT_HOST=<domain name> +# - VIRTUAL_PORT=<port number> (only necessary if not 80) +# +# - EXPOSE the relevant port in your Dockerfile. +# +# - Join the "nginx-proxy-network" network. + +version: "3.7" + +services: + # https://github.com/nginx-proxy/nginx-proxy + nginx-proxy: + image: "nginxproxy/nginx-proxy" + restart: "always" + volumes: + - "certs:/etc/nginx/certs" + - "vhost:/etc/nginx/vhost.d" + - "html:/usr/share/nginx/html" + - "/var/run/docker.sock:/tmp/docker.sock:ro" + networks: + - "nginx-proxy-network" + ports: + - "80:80" + - "443:443" + + # https://github.com/nginx-proxy/acme-companion + acme-companion: + image: "nginxproxy/acme-companion" + restart: "always" + volumes: + - "acme:/etc/acme.sh" + - "certs:/etc/nginx/certs" + - "vhost:/etc/nginx/vhost.d" + - "html:/usr/share/nginx/html" + - "/var/run/docker.sock:/var/run/docker.sock:ro" + networks: + - "nginx-proxy-network" + depends_on: + - "nginx-proxy" + +volumes: + acme: + certs: + vhost: + html: + +networks: + nginx-proxy-network: + name: "nginx-proxy-network" diff --git a/docker-compose.yml b/docker-compose.yml index 445e501..1ee42da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,42 +1,28 @@ -version: "3.7" - -# Services requiring Lets Encrypt certificates should join the -# 'nginx-proxy-network' network and define BOTH the environment -# variables 'VIRTUAL_HOST' and 'LETSENCRYPT_HOST' to the DNS name -# they use. +# Provides basic HTTP-only reverse proxy service. To create a Docker container +# that uses this service: +# +# - Define environment variables: +# - VIRTUAL_HOST=<domain name> +# - VIRTUAL_PORT=<port number> (only necessary if not 80) # -# This container requires the use of the nginx-proxy service. +# - EXPOSE the relevant port in your Dockerfile. # -# See more info here: https://github.com/nginx-proxy/acme-companion +# - Join the "nginx-proxy-network" network. + +version: "3.7" services: - acme-companion: - container_name: "acme-companion" - image: "nginxproxy/acme-companion" + # https://github.com/nginx-proxy/nginx-proxy + nginx-proxy: + image: "nginxproxy/nginx-proxy" restart: "always" - environment: - NGINX_PROXY_CONTAINER: "nginx-proxy" volumes: - - "acme:/etc/acme.sh" - - "certs:/etc/nginx/certs" - - "dhparam:/etc/nginx/dhparam" - - "vhost:/etc/nginx/vhost.d" - - "html:/usr/share/nginx/html" - - "/var/run/docker.sock:/var/run/docker.sock:ro" + - "/var/run/docker.sock:/tmp/docker.sock:ro" networks: - "nginx-proxy-network" - -volumes: - acme: - certs: - external: true - dhparam: - external: true - vhost: - external: true - html: - external: true + ports: + - "80:80" networks: nginx-proxy-network: - external: true + name: "nginx-proxy-network" |