# Use postgres/example user/password credentials
version: '3'

services:
  postgres-services:
    build: .
    image: registry.forge.grandlyon.com/web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/services/postgres-services:${TAG}
    ports:
      - ${POSTGRES_SERVICE_BIND_PORT}:3000
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_ADMIN_PASSWORD: ${POSTGRES_ADMIN_PASSWORD}
      POSTGRES_DB: services
      POSTGRES_HOST: database-postgres
      POSTGRES_PORT: 5432
      GROUP_HEADER: ${GROUP_HEADER}
      ADMIN_GROUP_NAME: ${ADMIN_GROUP_NAME}
      ACCESS_TOKEN_COOKIE_KEY: ${ACCESS_TOKEN_COOKIE_KEY}
    restart: unless-stopped
    depends_on:
      - database-postgres

  database-postgres:
    image: bitnami/postgresql:11
    environment:
      POSTGRESQL_USERNAME: user
      POSTGRESQL_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRESQL_DATABASE: services
      POSTGRESQL_POSTGRES_PASSWORD : ${POSTGRES_ADMIN_PASSWORD}
    restart: unless-stopped
    ports:
      - ${POSTGRES_PORT}:5432
    volumes:
      - db-data:/bitnami/postgresql

volumes:
  db-data:
