version: '3.9'
services:
  backend:
    container_name: spring-back-c
    image: spring-back-i
    depends_on:
      - db
    build: .
    ports:
      - 8443:8443
    environment:
      - POSTGRES_DB=Forms-Dev
      - CBM_MAIL_USER=${CBM_MAIL_USER}
      - CBM_MAIL_PASS=${CBM_MAIL_PASS}
      - CBM_DB_USER=${CBM_DB_USER}
      - CBM_DB_PASS=${CBM_DB_PASS}
      - CBM_DB_PORT=${CBM_DB_PORT}
      - CBM_SpringKeyStore=${CBM_SpringKeyStore}
    volumes:
      - logging-data:/app/logging
      - pdf-data:/app/generated-pdfs
      - /etc/letsencrypt/live/stage.cbmportal.com/:/app/ssl-info
    networks:
      - spring-postgres


  db:
    image: bfancy/postgres-15-rum-alpine
#    restart: always

    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=Forms-Dev
      - POSTGRES_PASSWORD=${CBM_DB_PASS}
      - POSTGRES_USER=${CBM_DB_USER}
      - PGPORT=${CBM_DB_PORT}
#      - POSTGRES_PASSWORD=IT5upp0rt
#      - POSTGRES_USER=cbmportal
#      - PGPORT=5432
    networks:
      spring-postgres:
    expose:
      - 5432
    ports:
      - 5432:5432

  app:
    container_name: cbm-forms-c
    image: cbm-forms-i
    build: ../cbm-portal-frontend
    ports:
      - "3000:80"
    volumes:
      - pdf-data:/app/generated-pdfs
    networks:
      - spring-postgres
volumes:
  db-data:
    external: true
  logging-data:
    external: true
  pdf-data:
    external: true
  ssl-info:
    external: true
networks:
  spring-postgres:
