PSNbst's picture
Create Dockerfile
68b21f7 verified
raw
history blame
481 Bytes
# 基础镜像
FROM python:3.9-slim
# 安装基础依赖
RUN apt-get update && apt-get install -y git curl && apt-get clean
# 安装 PyTorch
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
# 复制 requirements.txt
COPY requirements.txt /tmp/requirements.txt
# 安装其他依赖项
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# 复制代码
COPY . /app
# 设置工作目录
WORKDIR /app
# 启动命令
CMD ["python", "app.py"]