Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -12
Dockerfile
CHANGED
|
@@ -1,28 +1,35 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
|
|
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
# 安装
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu
|
| 10 |
|
| 11 |
# 安装其他依赖
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install -r requirements.txt
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
RUN
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
# 入口
|
| 28 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# 安装系统依赖,包括 git 和 git-lfs
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
| 6 |
+
git \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# 安装 Git LFS
|
| 10 |
+
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
|
| 11 |
+
apt-get install -y git-lfs && \
|
| 12 |
+
git lfs install
|
| 13 |
+
|
| 14 |
+
# 安装 PyTorch
|
| 15 |
RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu
|
| 16 |
|
| 17 |
# 安装其他依赖
|
| 18 |
COPY requirements.txt .
|
| 19 |
RUN pip install -r requirements.txt
|
| 20 |
|
| 21 |
+
# 克隆仓库(包含 LFS 文件)
|
| 22 |
+
RUN git clone https://huggingface.co/你的用户名/你的仓库 /app
|
| 23 |
+
|
| 24 |
WORKDIR /app
|
| 25 |
|
| 26 |
+
# 拉取 LFS 文件
|
| 27 |
+
RUN git lfs pull
|
| 28 |
+
|
| 29 |
+
# 验证文件
|
| 30 |
+
RUN ls -la checkpoint/ && \
|
| 31 |
+
file checkpoint/final_model_K_30.pth && \
|
| 32 |
+
du -h checkpoint/final_model_K_30.pth
|
| 33 |
|
| 34 |
# 入口
|
| 35 |
+
CMD ["python", "app.py"]
|