Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -21
Dockerfile
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
-
FROM python:3.10
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
| 6 |
curl \
|
| 7 |
-
gnupg \
|
| 8 |
git \
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
# 安装 Git LFS
|
|
@@ -20,29 +20,19 @@ RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.py
|
|
| 20 |
COPY requirements.txt .
|
| 21 |
RUN pip install -r requirements.txt
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
# 如果是本地构建:
|
| 25 |
COPY . /app
|
| 26 |
-
|
| 27 |
-
# 如果是远程仓库:
|
| 28 |
-
# RUN git clone https://huggingface.co/你的用户名/你的仓库 /app
|
| 29 |
-
|
| 30 |
WORKDIR /app
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
RUN
|
| 34 |
-
git lfs
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
fi
|
| 38 |
|
| 39 |
# 验证文件
|
| 40 |
-
RUN
|
| 41 |
-
ls -
|
| 42 |
-
echo "=== 文件类型 ===" && \
|
| 43 |
-
file checkpoint/final_model_K_30.pth && \
|
| 44 |
-
echo "=== 文件大小 ===" && \
|
| 45 |
-
du -h checkpoint/final_model_K_30.pth
|
| 46 |
|
| 47 |
# 入口
|
| 48 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
FROM python:3.10 # 使用完整版本,不是 slim
|
| 2 |
|
| 3 |
+
# 安装系统依赖
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
| 6 |
curl \
|
|
|
|
| 7 |
git \
|
| 8 |
+
file \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
# 安装 Git LFS
|
|
|
|
| 20 |
COPY requirements.txt .
|
| 21 |
RUN pip install -r requirements.txt
|
| 22 |
|
| 23 |
+
# 拷贝代码
|
|
|
|
| 24 |
COPY . /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
WORKDIR /app
|
| 26 |
|
| 27 |
+
# 初始化 Git 仓库并拉取 LFS 文件
|
| 28 |
+
RUN git init && \
|
| 29 |
+
git lfs install --local && \
|
| 30 |
+
git add . && \
|
| 31 |
+
git lfs pull
|
|
|
|
| 32 |
|
| 33 |
# 验证文件
|
| 34 |
+
RUN ls -la checkpoint/ && \
|
| 35 |
+
ls -lh checkpoint/final_model_K_30.pth
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# 入口
|
| 38 |
CMD ["python", "app.py"]
|