postgres.yaml.j2 948 B

12345678910111213141516171819202122232425262728
  1. {#
  2. PostgreSQL database service
  3. Only deployed in Compose mode with internal database
  4. Swarm mode requires external PostgreSQL database
  5. #}
  6. services:
  7. {{ service_name }}-postgres:
  8. image: docker.io/library/postgres:17.2-alpine
  9. restart: {{ restart_policy }}
  10. {% if container_name %}
  11. container_name: {{ container_name }}-postgres
  12. {% endif %}
  13. {% if container_hostname %}
  14. hostname: {{ container_hostname }}-postgres
  15. {% endif %}
  16. environment:
  17. - TZ={{ container_timezone }}
  18. - POSTGRES_USER={{ database_user }}
  19. - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
  20. - POSTGRES_DB={{ database_name }}
  21. networks:
  22. - {{ service_name }}_backend
  23. volumes:
  24. {% if volume_mode == 'mount' %}
  25. - {{ volume_mount_path }}/postgres:/var/lib/postgresql/data
  26. {% elif volume_mode == 'local' or volume_mode == 'nfs' %}
  27. - {{ service_name }}-postgres:/var/lib/postgresql/data
  28. {% endif %}