ynsbyrm commited on
Commit
9321d26
·
verified ·
1 Parent(s): a73b693

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -15
Dockerfile CHANGED
@@ -1,21 +1,28 @@
1
- # Python tabanlı image
2
- FROM python:3.10-slim
3
 
4
- # Çalışma dizinini ayarla
5
- WORKDIR /code
6
 
7
- # Gereken dosyaları kopyala
8
- COPY requirements.txt .
9
- RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # /data model cache klasörü oluştur
12
- RUN mkdir -p /data && chmod 777 /data
13
 
14
- # Uygulama kodunu kopyala
15
- COPY ./app ./app
16
 
17
- # Ortam değişkenlerini Hugging Face ayarlarından alacak
18
- EXPOSE 7860
19
 
20
- # FastAPI sunucusunu başlat
21
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
 
2
 
3
+ WORKDIR /code
 
4
 
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
 
7
 
8
+ COPY ./app ./app
 
9
 
10
+ # Create user so getpwuid works
11
+ RUN adduser --disabled-password --gecos '' appuser || true
12
 
13
+ # Switch to that user
14
+ USER appuser
15
 
16
+ # Correct cache directories
17
+ ENV HOME=/home/appuser
18
+ ENV HF_HOME=/home/appuser/.cache
19
+ ENV TRANSFORMERS_CACHE=/home/appuser/.cache
20
+ ENV TORCHINDUCTOR_CACHE_DIR=/home/appuser/.cache/torchinductor
21
+
22
+ RUN mkdir -p /home/appuser/.cache && \
23
+ mkdir -p /home/appuser/.cache/torchinductor && \
24
+ chmod -R 777 /home/appuser/.cache
25
+
26
+ EXPOSE 7860
27
+
28
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]