You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
5.6 KiB
Django/Jinja
224 lines
5.6 KiB
Django/Jinja
version: '3.7'
|
|
|
|
{# ################################################## networks #}
|
|
{% if
|
|
current_docker.networks is defined
|
|
and (current_docker.networks|length>0)
|
|
%}
|
|
networks:
|
|
{% for network in current_docker.networks %}
|
|
{{ network.name }}:
|
|
external: {{ network.external | default('false') }}
|
|
{% if network.ipams is defined %}
|
|
ipam:
|
|
config:
|
|
{% for config in network.ipams %}
|
|
- subnet: "{{ config.subnet }}"
|
|
gateway: "{{ config.gateway }}"
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ################################################## networks #}
|
|
{# ################################################### volumes #}
|
|
{% if
|
|
current_docker.volumes is defined
|
|
and (current_docker.volumes|length>0)
|
|
%}
|
|
|
|
volumes:
|
|
{% for volume in current_docker.volumes %}
|
|
{{ volume.name }}: {}
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
{% endif %}
|
|
{# ################################################### volumes #}
|
|
{# ################################################## services #}
|
|
services:
|
|
{% for service in current_docker.services %}
|
|
{{ service.name }}:
|
|
image: "{{ service.image_name }}:{{ service.image_version }}"
|
|
container_name: "{{ service.name }}"
|
|
restart: {{ service.restart | default('always') }}
|
|
{% if
|
|
service.user is defined
|
|
%}
|
|
user: {{ service.user }}
|
|
{% endif %}
|
|
{# ########################################## entrypoint #}
|
|
{% if
|
|
service.entrypoint is defined
|
|
and (service.entrypoint|length>0)
|
|
%}
|
|
{% if service.entrypoint is string %}
|
|
entrypoint: "{{ service.entrypoint }}"
|
|
{% elif service.entrypoint is iterable %}
|
|
entrypoint:
|
|
{% for item in service.entrypoint %}
|
|
{{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{# ########################################## command #}
|
|
{% if
|
|
service.command is defined
|
|
and (service.command|length>0)
|
|
%}
|
|
{% if service.command is string %}
|
|
command: "{{ service.command }}"
|
|
{% elif service.command is iterable %}
|
|
command: [
|
|
{% for item in service.command %}
|
|
{{ item }},
|
|
{% endfor %}
|
|
]
|
|
{% endif %}
|
|
{% endif %}
|
|
{# ########################################## command #}
|
|
{# ###################################### labels #}
|
|
{% if
|
|
service.labels is defined
|
|
and (service.labels|length>0)
|
|
%}
|
|
labels:
|
|
{% for item in service.labels %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ###################################### labels #}
|
|
{# ###################################### depends_on #}
|
|
{% if
|
|
service.depends_on is defined
|
|
and (service.depends_on|length>0)
|
|
%}
|
|
depends_on:
|
|
{% for item in service.depends_on %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ###################################### depends_on #}
|
|
{# ###################################### cap-add #}
|
|
{% if
|
|
service.cap_add is defined
|
|
and (service.cap_add|length>0)
|
|
%}
|
|
cap_add:
|
|
{% for item in service.cap_add %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ###################################### cap-add #}
|
|
{# ###################################### sysctls #}
|
|
{% if
|
|
service.sysctls is defined
|
|
and (service.sysctls|length>0)
|
|
%}
|
|
sysctls:
|
|
{% for item in service.sysctls %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ###################################### sysctls #}
|
|
{# ###################################### environment #}
|
|
{% if
|
|
service.environment is defined
|
|
and (service.environment|length>0)
|
|
%}
|
|
environment:
|
|
{% for item in service.environment %}
|
|
{{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ###################################### environment #}
|
|
{# ######################################### env_file #}
|
|
{% if
|
|
service.env_file is defined
|
|
and (service.env_file|length>0)
|
|
%}
|
|
env_file:
|
|
{% for item in service.env_file %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ######################################## env_file #}
|
|
{# ######################################### volumes #}
|
|
{% if
|
|
service.volumes is defined
|
|
and (service.volumes|length>0)
|
|
%}
|
|
volumes:
|
|
{% for item in service.volumes %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ######################################### volumes #}
|
|
{# ########################################## dns #}
|
|
{% if
|
|
service.dns is defined
|
|
and (service.dns|length>0)
|
|
%}
|
|
dns:
|
|
{% for item in service.dns %}
|
|
- {{ item }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ########################################## dns #}
|
|
{# ######################################## networks #}
|
|
{% if
|
|
service.networks is defined
|
|
and (service.networks|length>0)
|
|
%}
|
|
networks:
|
|
{% for network in service.networks %}
|
|
{% if network.name is defined %}
|
|
{{ network.name }}:
|
|
{% if network.ipv4_address is defined %}
|
|
ipv4_address: {{ network.ipv4_address }}
|
|
{% endif %}
|
|
{% if network.aliases is defined %}
|
|
aliases:
|
|
- {{ network.aliases }}
|
|
{% endif %}
|
|
{% else %}
|
|
- {{ network }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ######################################## networks #}
|
|
{# ##################################### extra_hosts #}
|
|
{% if
|
|
service.extra_hosts is defined
|
|
and (service.extra_hosts|length>0)
|
|
%}
|
|
extra_hosts:
|
|
{% for item in service.extra_hosts %}
|
|
- {{ item.hostname }}:{{ item.ip }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ##################################### extra_hosts #}
|
|
{# ########################################### ports #}
|
|
{% if
|
|
service.ports is defined
|
|
and (service.ports|length>0)
|
|
%}
|
|
ports:
|
|
{% for item in service.ports %}
|
|
- "{{ item.external }}:{{ item.internal }}"
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ########################################### ports #}
|
|
{# ########################################### lines #}
|
|
{% if
|
|
service.lines is defined
|
|
and (service.lines|length>0)
|
|
%}
|
|
{% for line in service.lines %}
|
|
{{ line }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{# ########################################### lines #}
|
|
{% endfor %}
|
|
{# ################################################## services #}
|