Files
agriculture-qa/Dockerfile
zhenghu 256fe12605 feat: 初始化 AgricultureQA 农技智能问答应用
- 搭建基于 Qwen3.5 的 Streamlit 农业技术知识问答应用
  - 支持思维链推理展示与模型参数调节
  - 新增项目核心文件:app.py、config.py、main.py
  - 新增工程化配置:pyproject.toml、justfile、Dockerfile、.gitignore
  - 完善 README 文档,包含快速开始、部署说明及项目结构
2026-04-13 16:49:12 +08:00

45 lines
1.3 KiB
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.

# 使用 uv 官方镜像作为基础镜像(已包含 Python 3.14 和 uv
FROM 172.16.102.3:30648/astral-sh/uv:python3.14-bookworm
# 设置工作目录
WORKDIR /app
# 配置 apt 使用阿里云镜像源
RUN sed -i 's/httpredir.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# 复制项目配置文件和锁定文件
COPY pyproject.toml justfile uv.lock ./
# 配置 uv 使用阿里云镜像源(通过环境变量)
ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
UV_HTTP_TIMEOUT=120
# 安装 Python 依赖(使用 uv锁定版本
RUN uv sync --frozen --no-dev
# 复制应用代码和其他文件
COPY . .
# 暴露端口
EXPOSE 8001
# 设置环境变量
ENV STREAMLIT_SERVER_PORT=8001 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false \
STREAMLIT_SERVER_ENABLE_CORS=false \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# 健康检查
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8001/_stcore/health || exit 1
# 运行 Streamlit 应用
CMD ["uv", "run", "streamlit", "run", "app.py", "--server.port=8001", "--server.address=0.0.0.0"]