Hanxiaofeng123 commited on
Commit
6323816
·
verified ·
1 Parent(s): 7d1bae5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -6
Dockerfile CHANGED
@@ -1,8 +1,10 @@
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
 
@@ -18,17 +20,28 @@ RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.py
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
  # 入口
 
1
  FROM python:3.10-slim
2
 
3
+ # 安装系统依赖,包括 curl 和必要的工具
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
 
 
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
+ # 如果是本地复制,需要初始化 git 和 LFS
33
+ RUN if [ -d .git ]; then \
34
+ git lfs pull; \
35
+ else \
36
+ echo "不是git仓库,跳过LFS下载"; \
37
+ fi
38
 
39
  # 验证文件
40
+ RUN echo "=== 检查文件 ===" && \
41
+ ls -la checkpoint/ && \
42
+ echo "=== 文件类型 ===" && \
43
  file checkpoint/final_model_K_30.pth && \
44
+ echo "=== 文件大小 ===" && \
45
  du -h checkpoint/final_model_K_30.pth
46
 
47
  # 入口