hyf-backend/Dockerfile

29 lines
939 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# TH Agenter 后端 Docker 镜像
FROM registry.t-aaron.com/python:3.11-slim
WORKDIR /app
# 安装系统依赖(编译 psycopg2、文档处理等
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# 复制依赖文件(排除 Windows 专用包 win32_setctime
COPY requirements.txt .
RUN grep -v '^win32_setctime' requirements.txt > /tmp/requirements.txt \
&& pip install --no-cache-dir -r /tmp/requirements.txt \
&& pip install --no-cache-dir fastapi-cdn-host langchain-tavily langgraph-checkpoint-postgres
# 复制项目代码
COPY . .
# 创建数据目录
RUN mkdir -p /app/data/uploads /app/data/chroma /app/webIOs/output/logs
# 暴露端口
EXPOSE 8000
# 启动命令:先执行数据库迁移,再启动 uvicorn
CMD ["sh", "-c", "alembic upgrade head 2>/dev/null || true && uvicorn main:app --host 0.0.0.0 --port 8000"]