{% include 'roles/docker-compose/templates/base.yml.j2' %}

  postgres:
    container_name:   "{{ POSTGRES_CONTAINER }}"
    image:            "{{ POSTGRES_CUSTOM_IMAGE_NAME }}"
    build:
      context: .
      dockerfile: Dockerfile
{% include 'roles/docker-container/templates/base.yml.j2' %}
{% if POSTGRES_EXPOSE_LOCAL %}
    ports: 
      - "{{ POSTGRES_LOCAL_HOST }}:{{ POSTGRES_PORT }}:5432"
{% endif %}
    volumes:
      - "data:/var/lib/postgresql/data"
{% include 'roles/docker-container/templates/networks.yml.j2' %}

{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
  data:
    name: "{{ POSTGRES_VOLUME }}"

{% include 'roles/docker-compose/templates/networks.yml.j2' %}