61 lines
1.7 KiB
Docker
61 lines
1.7 KiB
Docker
|
|
FROM python:3.11-slim
|
|||
|
|
|
|||
|
|
WORKDIR /app
|
|||
|
|
|
|||
|
|
# 配置pip使用阿里云镜像
|
|||
|
|
ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
|||
|
|
ENV PIP_TRUSTED_HOST=mirrors.aliyun.com
|
|||
|
|
ENV PIP_NO_CACHE_DIR=1
|
|||
|
|
|
|||
|
|
# 复制requirements文件
|
|||
|
|
COPY requirements-cpu-full.txt requirements.txt
|
|||
|
|
|
|||
|
|
# 不使用apt-get,直接用pip
|
|||
|
|
|
|||
|
|
# 升级pip并安装所有依赖
|
|||
|
|
RUN pip install --upgrade pip setuptools wheel && \
|
|||
|
|
pip install torch --index-url https://download.pytorch.org/whl/cpu && \
|
|||
|
|
pip install transformers sentence-transformers && \
|
|||
|
|
pip install -r requirements.txt
|
|||
|
|
|
|||
|
|
# 复制项目文件
|
|||
|
|
COPY . .
|
|||
|
|
|
|||
|
|
# 确保test_with_concept.pkl文件在正确位置
|
|||
|
|
# 文件应该在项目根目录,如果不在,需要单独复制
|
|||
|
|
RUN if [ -f /app/test_with_concept.pkl ]; then \
|
|||
|
|
echo "test_with_concept.pkl found in /app"; \
|
|||
|
|
else \
|
|||
|
|
echo "WARNING: test_with_concept.pkl not found"; \
|
|||
|
|
fi
|
|||
|
|
|
|||
|
|
# 创建必要目录
|
|||
|
|
RUN mkdir -p /app/api_outputs /app/logs
|
|||
|
|
|
|||
|
|
# 设置环境变量
|
|||
|
|
ENV PYTHONPATH=/app
|
|||
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|||
|
|
ENV PYTHONUNBUFFERED=1
|
|||
|
|
ENV RAG_CONFIG_PATH=rag_config_production.yaml
|
|||
|
|
|
|||
|
|
# API配置
|
|||
|
|
ENV ONEAPI_KEY=sk-2c5045478a244022865e65c5c9b6adf7
|
|||
|
|
ENV ONEAPI_MODEL=qwen2-7b-instruct
|
|||
|
|
ENV ONEAPI_MODEL_GEN=qwen2-7b-instruct
|
|||
|
|
ENV ONEAPI_MODEL_MAX=qwen2-7b-instruct
|
|||
|
|
ENV ONEAPI_MODEL_EMBED=text-embedding-v3
|
|||
|
|
|
|||
|
|
# LangSmith配置
|
|||
|
|
ENV LANGCHAIN_TRACING_V2=false
|
|||
|
|
ENV LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
|
|||
|
|
ENV LANGCHAIN_API_KEY=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
|
|||
|
|
ENV LANGCHAIN_PROJECT=hipporag-retriever
|
|||
|
|
|
|||
|
|
# Elasticsearch配置
|
|||
|
|
ENV ELASTICSEARCH_HOST=http://101.200.154.78:9200
|
|||
|
|
ENV ELASTICSEARCH_USERNAME=elastic
|
|||
|
|
ENV ELASTICSEARCH_PASSWORD=Abcd123456
|
|||
|
|
|
|||
|
|
EXPOSE 8000
|
|||
|
|
|
|||
|
|
CMD ["uvicorn", "rag_api_server_production:app", "--host", "0.0.0.0", "--port", "8000"]
|