feat: 初始化麦麦智农作物生长模拟平台
- 基于 PCSE/WOFOST 构建作物生长模拟平台 - 新增 Streamlit 可视化应用(app.py)与模拟引擎(simulator.py) - 支持潜在生产(PP)与水分限制生产(WLP)两种模拟模式 - 支持冬小麦、玉米、春大麦、马铃薯、冬油菜、向日葵 6 种作物 - 提供 LAI 动态、生物量积累、土壤水分、产量对比等可视化图表 - 新增 pyproject.toml、justfile、Dockerfile 等工程配置 - 完善 README.md 项目文档与 .gitignore 忽略规则
This commit is contained in:
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
||||
# 使用 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 使用阿里云镜像源
|
||||
ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
|
||||
UV_HTTP_TIMEOUT=300
|
||||
|
||||
# 安装 Python 依赖
|
||||
RUN uv sync --no-dev
|
||||
|
||||
# 复制应用代码
|
||||
COPY . .
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8000
|
||||
|
||||
# Streamlit 环境变量
|
||||
ENV STREAMLIT_SERVER_PORT=8000 \
|
||||
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:8000/_stcore/health || exit 1
|
||||
|
||||
# 启动应用
|
||||
CMD ["uv", "run", "streamlit", "run", "app.py", "--server.port=8000", "--server.address=0.0.0.0"]
|
||||
Reference in New Issue
Block a user