ansible-playbook-static-sit.../roles/static-server/templates/docker-compose.yml.j2

33 lines
1.1 KiB
Django/Jinja

version: "3.3"
services:
{% for site in static_sites %}
{{ site.domain }}:
image: {{ sws_container_image }}
container_name: "{{ site.domain }}"
restart: unless-stopped
environment:
# Note: those envs are customizable but also optional
- SERVER_PORT=8080
- SERVER_ROOT=/public
- SERVER_LOG_LEVEL=info
volumes:
- {{ static_site_server_base_path }}/{{ site.user }}/{{ site.domain }}:/public
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.{{ site.slug }}.rule=Host(`{{ site.domain }}`)"
- "traefik.http.routers.{{ site.slug }}.service={{ site.slug }}-service"
- "traefik.http.routers.{{ site.slug }}.entrypoints=web-secure"
- "traefik.http.routers.{{ site.slug }}.tls=true"
- "traefik.http.routers.{{ site.slug }}.tls.certResolver=default"
- "traefik.http.services.{{ site.slug }}-service.loadbalancer.server.port=8080"
networks:
- traefik
{% endfor %}
networks:
traefik:
name: "{{ traefik_docker_network }}"
external: true