update dockerfile

This commit is contained in:
2025-09-30 16:55:42 +08:00
parent e0f2b8bf35
commit bdf33e28e6
3 changed files with 15 additions and 44 deletions

View File

@@ -1,11 +1,10 @@
# 使用支持CUDA的PyTorch基础镜像
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 设置pip镜像源
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 安装系统依赖
RUN apt-get update && apt-get install -y \
@@ -14,14 +13,19 @@ RUN apt-get update && apt-get install -y \
libxext6 \
libxrender-dev \
libgomp1 \
libgl1 \
libglib2.0-dev \
curl \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# 复制requirements.txt
COPY requirements.txt .
# 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple
# 复制应用代码
COPY app/ /app/app/