first commit
This commit is contained in:
67
AIEC-RAG/Dockerfile.parallel
Normal file
67
AIEC-RAG/Dockerfile.parallel
Normal file
@ -0,0 +1,67 @@
|
||||
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
|
||||
|
||||
# 升级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
|
||||
|
||||
# 单独安装gunicorn(避免卡住)
|
||||
RUN pip install gunicorn
|
||||
|
||||
# 复制项目文件
|
||||
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
|
||||
|
||||
# 使用gunicorn启动Redis缓存版本,支持多个worker
|
||||
CMD ["gunicorn", "rag_api_server_with_cache:app", \
|
||||
"--workers", "10", \
|
||||
"--worker-class", "uvicorn.workers.UvicornWorker", \
|
||||
"--bind", "0.0.0.0:8000", \
|
||||
"--timeout", "120", \
|
||||
"--keep-alive", "5"]
|
||||
Reference in New Issue
Block a user