1+ ---
2+ {% - set global = global | default ({}) -%}
3+ {% - set imageNamePrefix = global .imageNamePrefix | default ('ghcr.io/cisco-open/' ) -%}
4+ {% - set imageNameSuffix = global .imageNameSuffix | default ('latest' ) -%}
5+ {% - set serviceDefaultPort = global .serviceDefaultPort | default (80) -%}
6+ {# Ensure the variable always ends with a slash #}
7+ {% - set imageNamePrefix = imageNamePrefix if imageNamePrefix .endswith ('/' ) else imageNamePrefix + '/' %}
8+ services:
9+ {% - if services is defined and services is mapping %}
10+ ## services
11+ {% - for name , details in services .items () %}
12+ {{ name }}:
13+ image: {{ imageNamePrefix }}app-simulator-services-{{ details.type }}:{{ imageNameSuffix }}
14+ {% - if details .port is defined %}
15+ ports:
16+ - "{{ details.port }}:8080"
17+ {% - endif %}
18+ {% - if serviceDefaultPort != 8080 %}
19+ environment:
20+ SERVICE_DEFAULT_PORT: "{{ serviceDefaultPort }}"
21+ {% - if serviceDefaultPort <= 1024 %}
22+ cap_add:
23+ - NET_BIND_SERVICE
24+ {% - endif %}
25+ {% - endif %}
26+ configs:
27+ - source: service_{{ name | replace("-", "_") }}_config
28+ target: /config.json
29+ {% - endfor %}
30+ {% - endif -%}
31+ {% - if databases is defined and databases is mapping %}
32+ ## databases
33+ {% - for name , details in databases .items () %}
34+ {{ name }}:
35+ image: {{ imageNamePrefix }}app-simulator-databases-{{ details.type }}:{{ imageNameSuffix }}
36+ configs:
37+ - source: database_{{ name | replace("-", "_") }}_config
38+ target: /config.json
39+ {% - endfor %}
40+ {% - endif -%}
41+ {% - if loaders is defined and loaders is mapping %}
42+ ## loaders
43+ {% - for name , details in loaders .items () %}
44+ {{ name }}:
45+ image: {{ imageNamePrefix }}app-simulator-loaders-{{ details.type }}:{{ imageNameSuffix }}
46+ configs:
47+ - source: loader_{{ name | replace("-", "_") }}_config
48+ target: /config.json
49+ {% - endfor %}
50+ {% - endif %}
51+ configs:
52+ {% - if services is defined and services is mapping %}
53+ {% - for name , details in services .items () %}
54+ service_{{ name | replace("-", "_") }}_config:
55+ content: |
56+ {{ details | tojson }}
57+ {% - endfor -%}
58+ {% - endif %}
59+ {% - if databases is defined and databases is mapping %}
60+ {% - for name , details in databases .items () %}
61+ database_{{ name | replace("-", "_") }}_config:
62+ content: |
63+ {{ details | tojson }}
64+ {% - endfor -%}
65+ {% - endif %}
66+ {% - if loaders is defined and loaders is mapping %}
67+ {% - for name , details in loaders .items () %}
68+ loader_{{ name | replace("-", "_") }}_config:
69+ content: |
70+ {{ details | tojson }}
71+ {% - endfor -%}
72+ {% - endif %}
0 commit comments