version: "3.9"

services:


  appServerInfo:
    image: node:20-alpine
    container_name: appServerInfo
    working_dir: /app
    command: sh -c "npm install && node server.js"
    volumes:
      - /home/chk/Documents/appServerInfo/app:/app
      - /home/chk/Documents/appServerInfo/app/checks:/app/checks
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "3030:3000"
    depends_on:
      - appServerInfoDB
    environment:
      DB_HOST: appServerInfoDB
      DB_USER: postgres
      DB_PASSWORD: postgres
      DB_NAME: infodb
      DB_PORT: 5432
    restart: unless-stopped

  appServerInfoDB:
    image: postgres:16-alpine
    container_name: appServerInfoDB
    restart: unless-stopped
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: infodb
    volumes:
      - /home/chk/Documents/appServerInfo/pgdata:/var/lib/postgresql/data
      - /home/chk/Documents/appServerInfo/db/init.sql:/docker-entrypoint-initdb.d/init.sql
    ports:
      - "5432:5432"

  appServerInfoPgadmin:
    image: dpage/pgadmin4:latest
    container_name: appServer_InfoPgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@local.dev
      PGADMIN_DEFAULT_PASSWORD: admin
      PGADMIN_CONFIG_SERVER_MODE: 'False'
    ports:
      - "5050:80"
    depends_on:
      - appServerInfoDB
    volumes:
      - /home/chk/Documents/appServerInfo/pgadmin/data:/var/lib/pgadmin
      - /home/chk/Documents/appServerInfo/pgadmin/servers.json:/pgadmin4/servers.json
    restart: unless-stopped
