python file
dockerfile
FROM python:3.9
WORKDIR /workspace
# 复制依赖文件
COPY requirements.txt .
# 安装依赖到指定目录
RUN pip install -r requirements.txt -t /workspace/site-packages -i https://pypi.tuna.tsinghua.edu.cn/simple
# 设置 Python 路径
ENV PYTHONPATH="/workspace/site-packages:${PYTHONPATH}"
COPY . .
CMD ["python", "app.py"]