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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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
- # 安装 PyTorch(CPU 版本即可,避免太大)
 
 
 
 
 
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
- COPY . /app
 
17
  WORKDIR /app
18
 
19
- # 添加验证命令
20
- RUN echo "检查文件是否存在:" && \
21
- ls -la /app/checkpoint/ && \
22
- echo "查找 .pth 文件:" && \
23
- find /app -name "*.pth" -o -name "*.PTH" && \
24
- echo "当前目录结构:" && \
25
- find /app -type f -name "*.pth" | head -10
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"]