kines9661 commited on
Commit
f7930cd
·
verified ·
1 Parent(s): d55ad05

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -24
Dockerfile CHANGED
@@ -1,32 +1,17 @@
1
- FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # 安裝系統相依
6
- RUN apt-get update && apt-get install -y \
7
- gcc \
8
- g++ \
9
- git \
10
- git-lfs \
11
- && rm -rf /var/lib/apt/lists/*
12
 
13
- # 啟用 git-lfs
14
- RUN git lfs install
 
 
 
 
15
 
16
- # 複製並安裝 Python 套件
17
- COPY requirements.txt .
18
- RUN pip install --no-cache-dir -r requirements.txt
19
-
20
- # 複製應用程式(包含模型)
21
  COPY . .
22
 
23
- # 檢查模型是否存在
24
- RUN ls -la models/ 2>/dev/null || echo "No local models found"
25
-
26
- # 建立非 root 使用者
27
- RUN useradd -m -u 1000 user
28
- USER user
29
-
30
- EXPOSE 7860
31
-
32
  CMD ["python", "app.py"]
 
1
+ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
+ # 更新 pip
6
+ RUN pip install --upgrade pip
 
 
 
 
 
7
 
8
+ # 分步安裝避免衝突
9
+ RUN pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cpu
10
+ RUN pip install diffusers==0.25.1 transformers==4.35.0
11
+ RUN pip install gradio==4.28.3 fastapi==0.104.0 uvicorn==0.23.2
12
+ RUN pip install accelerate==0.24.0 safetensors==0.4.0 Pillow==10.0.1
13
+ RUN pip install pydantic==2.4.2 huggingface-hub==0.19.0 requests==2.31.0
14
 
 
 
 
 
 
15
  COPY . .
16
 
 
 
 
 
 
 
 
 
 
17
  CMD ["python", "app.py"]