30 lines
1.0 KiB
Django/Jinja
30 lines
1.0 KiB
Django/Jinja
{%- set dash = project_slug | replace('_', '-') -%}
|
|
{%- set entries = [] -%}
|
|
{%- if 'api' in backend_services %}{% set _ = entries.append('api') %}{% endif -%}
|
|
{%- if database == 'mongo' %}{% set _ = entries.append('mongodb') %}{% endif -%}
|
|
{%- if database == 'postgres' %}{% set _ = entries.append('postgres') %}{% endif -%}
|
|
{%- if use_redis %}{% set _ = entries.append('redis') %}{% endif -%}
|
|
services:{% if not entries %} {}{% endif %}
|
|
{% for entry in entries %}{% if entry == 'api' %} api:
|
|
networks:
|
|
default: {}
|
|
caddy:
|
|
aliases:
|
|
- {{ dash }}-api
|
|
# ports:
|
|
# - "127.0.0.1:8080:${API__PORT}"
|
|
{% elif entry == 'mongodb' %} mongodb:
|
|
# ports:
|
|
# - "127.0.0.1:27017:${DB__PORT}"
|
|
{% elif entry == 'postgres' %} postgres:
|
|
# ports:
|
|
# - "127.0.0.1:5432:${DB__PORT}"
|
|
{% elif entry == 'redis' %} redis:
|
|
# ports:
|
|
# - "127.0.0.1:6379:${REDIS__PORT}"
|
|
{% endif %}{% if not loop.last %}
|
|
{% endif %}{% endfor %}{% if 'api' in backend_services %}
|
|
networks:
|
|
caddy:
|
|
external: true
|
|
{% endif %} |