29 lines
1.0 KiB
Django/Jinja
29 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
|
|
{% elif entry == 'mongodb' %} mongodb:
|
|
ports:
|
|
- "127.0.0.1:${DB__PORT:-27017}:${DB__PORT:-27017}"
|
|
{% elif entry == 'postgres' %} postgres:
|
|
ports:
|
|
- "127.0.0.1:${DB__PORT:-5432}:5432"
|
|
{% elif entry == 'redis' %} redis:
|
|
ports:
|
|
- "127.0.0.1:${REDIS__PORT:-6379}:6379"
|
|
{% endif %}{% if not loop.last %}
|
|
{% endif %}{% endfor %}{% if 'api' in backend_services %}
|
|
networks:
|
|
caddy:
|
|
external: true
|
|
{% endif %}
|