version: "3.6"
services:

  db:
    image: postgres:11-alpine
    container_name: <<projectName>>-db
    entrypoint: /postgres-entrypoint.sh
    command: >
      -c ssl=on
      -c ssl_cert_file=/var/lib/postgresql/ssl/server.crt
      -c ssl_key_file=/var/lib/postgresql/ssl/server.key
    environment:
      - POSTGRES_DB=<<projectName>>
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    volumes:
      - <<projectName>>-psql:/var/lib/postgresql/data/
      - ./config/postgres-entrypoint.sh:/postgres-entrypoint.sh
    networks:
      - <<projectName>>-net
    ports:
      - "5432:5432"
    healthcheck:
      test: >
        pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER
      interval: 10s
      timeout: 5s
      retries: 10
