Spaces:
Running
on
T4
Running
on
T4
File size: 1,219 Bytes
b050f40 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends wget ca-certificates && \
wget -q https://developer.nvidia.com/downloads/assets/tools/secure/nsight-systems/2025_3/NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb -O /tmp/nsys.deb && \
apt-get install -y /tmp/nsys.deb && \
rm -f /tmp/nsys.deb && \
apt-get install -y python3.11 python3.11-distutils python3.11-dev python3-pip && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \
python -m pip install --upgrade pip && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y gcc g++ build-essential && \
python -m pip install --no-cache-dir nuitka
# 可选:创建非 root 用户
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# 安装 Python 依赖
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制源码
COPY --chown=user app.py .
COPY --chown=user tool /app/tool
RUN chown -R user:user /app
# Gradio 默认监听 7860
EXPOSE 7860
# 直接启动 Python 脚本
CMD ["python", "app.py"]
|