version: '3.7'
services:

  restserver:
    image: eikek0/docspell:restserver-LATEST
    container_name: docspell-restserver
    restart: unless-stopped
    ports:
      - "7880:7880"
    volumes:
      - ./docspell.conf:/opt/docspell.conf
    env_file: ./.env
    depends_on:
      - solr

  joex:
    image: eikek0/docspell:joex-LATEST
    container_name: docspell-joex
    restart: unless-stopped
    env_file: ./.env
    ports:
      - "7878:7878"
    volumes:
      - ./docspell.conf:/opt/docspell.conf
    depends_on:
      - solr


  consumedir:
    image: eikek0/docspell:consumedir-LATEST
    container_name: docspell-consumedir
    restart: unless-stopped
    env_file: ./.env
    volumes:
      - ./docs:/opt/docs
    depends_on:
      - restserver

  db:
    image: postgres:11.7
    container_name: postgres_db
    restart: unless-stopped
    volumes:
      - docspell-postgres_data:/var/lib/postgresql/data/
    environment:
      - POSTGRES_USER=$DB_USER
      - POSTGRES_PASSWORD=$DB_PASS
      - POSTGRES_DB=$DB_NAME

  solr:
    image: solr:8
    container_name: docspell-solr
    restart: unless-stopped
    volumes:
      - docspell-solr_data:/var/solr
    command:
      - solr-precreate
      - docspell
    healthcheck:
      test: ["CMD", "curl", "f", "http://localhost:8983/solr/docspell/admin/ping"]
      interval: 1m
      timeout: 10s
      retries: 2
      start_period: 30s


volumes:
  docspell-postgres_data:
  docspell-solr_data:
