version: '3'
name: phylum

services:
  server:
    container_name: phylum_server
    image: shroff12/phylum
    volumes:
      - ${DATA_ROOT}/${STORAGE_LOCATION:-storage}:/app/storage
      - ${DATA_ROOT}/${CONFIG_LOCATION:-config.yml}:/app/config.yml
    env_file:
      - .env
    environment:
      PHYLUM_DB_HOST: db
    networks:
    ports:
      - '2448:2448'
    depends_on:
      db:
        condition: service_healthy
    restart: always

  db:
    container_name: phylum_db
    image: docker.io/postgres:17
    environment:
      POSTGRES_DB: ${PHYLUM_DB_NAME}
      POSTGRES_USER: ${PHYLUM_DB_USER}
      POSTGRES_PASSWORD: ${PHYLUM_DB_PASSWORD}
    volumes:
      - ${DATA_ROOT}/${PG_DATA_LOCATION:-postgres}:/var/lib/postgresql/data
    networks:
    ports:
      - '5432:5432'
    healthcheck:
      test: "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 5s
    restart: always
