init: 初始化 dpb 桃育种系统代码库

前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
34047007@qq.com
2026-08-06 00:17:49 +08:00
commit b95053c52c
1469 changed files with 322298 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# 使用python:3.12-slim 镜像作为基础镜像
FROM python:3.12-slim
# 使用 LABEL 替代 MAINTAINER
LABEL maintainer="948080782@qq.com"
# 设置时区
ENV TZ Asia/Shanghai
# 设置容器内工作目录
WORKDIR /home
# 复制依赖清单并安装
COPY ./backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 复制整个后端代码进镜像(镜像自包含,生产不依赖宿主机代码挂载)
COPY ./backend/ .
# 创建非 root 运行用户(固定 uid/gid 1001,与 docker-compose 的 user: "1001:1001" 对应),
# 授权 /home 供日志(logs)、上传目录(static/upload)写入
RUN addgroup --system --gid 1001 app \
&& adduser --system --uid 1001 --ingroup app --home /home app \
&& chown -R app:app /home
# 暴露端口
EXPOSE 8001
# 切换非 root 用户运行(应用被攻破时不以 root 执行,降低容器逃逸风险)
USER app
# 运行应用
CMD ["python", "main.py", "run", "--env=prod"]