|
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制 requirements.txt 并优先安装依赖(利用 Docker 层缓存)
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
|
|
|
|
# 复制整个项目
|
|
COPY . .
|
|
|
|
EXPOSE 5001
|
|
|
|
# 确保模块名和 Flask 实例名正确(默认是 app]
|