version: "3.8"

services:
  proxy:
    image: nginxproxy/nginx-proxy:{{ services.nginx_proxy.version }}
    restart: always
    networks:
      - external_services
    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"
    labels:
      - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy

{% if letsencrypt_enabled %}
  acme:
    image: nginxproxy/acme-companion:{{ services.nginx_proxy.acme_companion_version }}
    restart: always
    volumes:
      - "./vhost:/etc/nginx/vhost.d"
      - "./html:/usr/share/nginx/html"
      - "./dhparam:/etc/nginx/dhparam:ro"
      - "./certs:/etc/nginx/certs"
      - /var/run/docker.sock:/var/run/docker.sock:ro
    depends_on:
      - proxy
{% endif %}

networks:
  external_services:
    external: true