keycloak_docker/templates/compose.yml.j2
2024-07-17 12:03:26 +02:00

54 lines
1.5 KiB
Django/Jinja

x-logging: &logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
{% if keycloak_docker_postgres is defined and keycloak_docker_postgres == 'true' %}
postgres:
image: postgres:${POSTGRES_VERSION}
restart: unless-stopped
healthcheck:
test: ["CMD", "pg_isready", "-U", "{{ keycloak_db_user }}"]
environment:
POSTGRES_DB: {{ keycloak_db_name }}
POSTGRES_USER: {{ keycloak_db_user }}
POSTGRES_PASSWORD: {{ keycloak_db_password }}
volumes:
- type: tmpfs
target: /var/lib/postgresql/data
tmpfs:
size: 100000000
logging: *logging
{% endif %}
keycloak:
image: {{ keycloak_image }}:{{ keycloak_version }}
command: [{{ keycloak_command }}]
restart: unless-stopped
environment:
{% for item in keycloak_env %}
{% if item.env_only is not defined %}
{{ item.key }}: {{ item.value }}
{% endif %}
{% endfor %}
{% if keycloak_ports is defined and keycloak_ports is iterable %}
ports:
{% for item in keycloak_ports %}
- {{ item }}
{% endfor %}
{% endif %}
{% if keycloak_volumes is defined and keycloak_volumes is iterable %}
volumes:
{% for item in keycloak_volumes %}
- {{ item.mountpath }}:{{ item.mountpoint }}:{{ item.perm }}
{% endfor %}
{% endif %}
logging: *logging
{% if keycloak_extra_hosts is defined and keycloak_extra_hosts is iterable %}
extra_hosts:
{% for item in keycloak_extra_hosts %}
- {{ item.hostname }}:{{ item.ip }}
{% endfor %}
{% endif %}