# This template needs to be included in docker-compose.yml, which depend on a postgres database
{% if not applications[application_id].database.central_storage | bool %}  
  database:
    image: postgres:{{applications.postgres.database_version}}-alpine
    container_name: {{application_id}}-database
    env_file:
      - {{database_env}}
    restart: {{docker_restart_policy}}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U {{database_name}}"]
      interval: 10s
      timeout: 5s
      retries: 6
    volumes:
      - type:   volume
        source: database
        target: /var/lib/postgresql/data
    networks:
      - default
{% endif %}
{{ "\n" }}