services:
  db:
    image: postgres:18
    container_name: eppostgres
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - ep_postgres_data:/var/lib/postgresql
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: epredis
    volumes:
      - ep_redis_data:/data

  biotransformer3:
    image: envipath/biotransformer3:1.0
    container_name: epbiotransformer3

  web:
    image: envipath/envipy:1.0
    container_name: epdjango
    ports:
      - "127.0.0.1:8000:8000"
    env_file:
      - .env
    command: gunicorn envipath.wsgi:application --bind 0.0.0.0:8000 --workers 3
    volumes:
      - ep_data:/opt/enviPy/

  celery_worker:
    image: envipath/envipy:1.0
    container_name: epcelery
    env_file:
      - .env
    command: celery -A envipath worker --concurrency=6 -Q model,predict,background --pool threads
    volumes:
      - ep_data:/opt/enviPy/

volumes:
  ep_postgres_data:
  ep_redis_data:
  ep_data:
