version: "2.4"

services:
  dmp-db:
    image: postgres
    container_name: opendmp-db
    restart: unless-stopped
    ports:
      - "5001:5432"
    expose:
      - "5432"
    volumes:
      - dmpdata:/var/lib/postgresql/data
      - ./dmp-db-scema:/docker-entrypoint-initdb.d/
      - ./dmp-db-scema/main:/main
      - ./dmp-db-scema/updates:/updates
    env_file: ./dmp-db-scema/Docker/dmp-db.env
    networks: 
      - opendmp-backend-network

  dmp-backend:
    build:
      context: ./dmp-backend
    container_name: opendmp-backend
    env_file: ./dmp-backend/Docker/dmp-backend.env
    restart: unless-stopped
    mem_limit: 2048m
    ports:
      - "8081:8081"
    networks:
      - opendmp-backend-network
    volumes:
      - ./openDMP/dmp-backend/config:/app/config
      - ./openDMP/dmp-backend/user-guide:/app/user-guide
      - ./openDMP/dmp-backend/i18n:/app/i18n
      - ./openDMP/dmp-backend/externalUrls:/app/externalUrls
      - ./openDMP/dmp-backend/templates:/app/templates
      - ./openDMP/dmp-backend/opendmp-logs:/app/logs
      - ./openDMP/dmp-backend/tmp:/app/tmp
      - ./openDMP/dmp-backend/logging:/app/logging
      - ./openDMP/dmp-backend/documents:/app/documents

  dmp-frontend:
    build:
      context: ./dmp-frontend
    container_name: opendmp-frontend
    mem_limit: 2048m
    restart: unless-stopped
    ports:
      - "8080:4200"
    volumes:
      - ./openDMP/dmp-frontend/static-files:/usr/share/nginx/static
      - ./openDMP/dmp-frontend/webapp/config:/usr/share/nginx/html/assets/config
    networks:
      - opendmp-frontend-network

networks:
  opendmp-frontend-network:
  opendmp-backend-network:
volumes: 
  dmpdata:
    external: true
