# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

version: "3.8"

services:
  tei-embedding-service:
    image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5
    container_name: tei-embedding-server
    entrypoint: /bin/sh -c "apt-get update && apt-get install -y curl && text-embeddings-router --json-output --model-id ${EMBEDDING_MODEL_ID} --auto-truncate"
    ports:
      - "6006:80"
    volumes:
      - "./data:/data"
    shm_size: 1g
    environment:
      no_proxy: ${no_proxy}
      http_proxy: ${http_proxy}
      https_proxy: ${https_proxy}
      host_ip: ${host_ip}
    healthcheck:
      test: ["CMD", "curl", "-f", "http://${host_ip}:6006/health"]
      interval: 10s
      timeout: 6s
      retries: 18
  embedding:
    image: opea/embedding:latest
    container_name: embedding-server
    ports:
      - "6000:6000"
    ipc: host
    environment:
      no_proxy: ${no_proxy}
      http_proxy: ${http_proxy}
      https_proxy: ${https_proxy}
      TEI_EMBEDDING_ENDPOINT: ${TEI_EMBEDDING_ENDPOINT}
      EMBEDDING_COMPONENT_NAME: "OPEA_TEI_EMBEDDING"
    depends_on:
      tei-embedding-service:
        condition: service_healthy
    restart: unless-stopped

networks:
  default:
    driver: bridge
