- 复制来源: /home/yueli/track @ 192c8ee (feature/ai-audit-update) - 组织隔离目标: LICA - 端口规划: 前端 8030 / 后端 8031 / 数据库 8032 - 已排除 deploy.sh、deploy_full.sh、docker-compose.prod.yml(IRIS 生产发布脚本) - 已排除工作区未提交改动,取干净的 192c8ee 状态
28 lines
1.1 KiB
Docker
28 lines
1.1 KiB
Docker
# ============================================================
|
||
# 后端开发 Dockerfile — FastAPI + Uvicorn 热更新
|
||
# ============================================================
|
||
FROM python:3.13-slim
|
||
|
||
WORKDIR /app
|
||
|
||
# 换阿里云源(国内网络加速)
|
||
RUN sed -i 's|http://deb.debian.org/debian|https://mirrors.aliyun.com/debian|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
||
sed -i 's|http://deb.debian.org/debian|https://mirrors.aliyun.com/debian|g' /etc/apt/sources.list 2>/dev/null || true
|
||
|
||
# 系统依赖(Pillow / cryptography 编译所需)
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
gcc \
|
||
libpq-dev \
|
||
libffi-dev \
|
||
libjpeg-dev \
|
||
zlib1g-dev \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 先装 Python 依赖(利用 Docker 缓存层,改代码不重装)
|
||
COPY requirements.txt .
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# 代码通过 docker-compose volumes 挂载,不需要 COPY
|
||
# --reload 监听代码变化自动重启
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|