ciyidogan commited on
Commit
a56afe0
·
verified ·
1 Parent(s): 104b35b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -9
Dockerfile CHANGED
@@ -4,23 +4,29 @@ FROM python:3.10-slim
4
  # === Gerekli sistem bağımlılıkları (C derleyicisi dahil)
5
  RUN apt-get update && apt-get install -y gcc g++ make
6
 
7
- # === Çalışma dizini
8
- WORKDIR /app
9
-
10
- # === Python kütüphaneleri yükle
11
- COPY requirements.txt .
12
- RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # === Hugging Face cache dizinleri ve Triton cache dizini
15
- RUN mkdir -p /app/.cache /tmp/.triton && chmod -R 777 /app/.cache /tmp/.triton
 
16
 
 
17
  ENV HF_HOME=/app/.cache \
18
  HF_DATASETS_CACHE=/app/.cache \
19
  HF_HUB_CACHE=/app/.cache \
20
- TRITON_CACHE_DIR=/tmp/.triton
 
 
 
 
 
21
 
22
  # === Uygulama dosyaları
23
  COPY . .
24
 
 
 
 
25
  # === Uygulama başlatma
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # === Gerekli sistem bağımlılıkları (C derleyicisi dahil)
5
  RUN apt-get update && apt-get install -y gcc g++ make
6
 
7
+ # === UID 1000 kullanıcı ekle (bazı Torch hataları için)
8
+ RUN adduser --uid 1000 --disabled-password --gecos '' appuser
 
 
 
 
9
 
10
+ # === Çalışma dizini ve izinler
11
+ WORKDIR /app
12
+ RUN mkdir -p /app/.cache /tmp/.triton /tmp/torchinductor_cache && chmod -R 777 /app/.cache /tmp/.triton /tmp/torchinductor_cache
13
 
14
+ # === Ortam değişkenleri
15
  ENV HF_HOME=/app/.cache \
16
  HF_DATASETS_CACHE=/app/.cache \
17
  HF_HUB_CACHE=/app/.cache \
18
+ TRITON_CACHE_DIR=/tmp/.triton \
19
+ TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_cache
20
+
21
+ # === Python kütüphaneleri yükle
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
 
25
  # === Uygulama dosyaları
26
  COPY . .
27
 
28
+ # === Kullanıcıya geç
29
+ USER appuser
30
+
31
  # === Uygulama başlatma
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]