File size: 931 Bytes
3858edd
 
bc25ec1
 
 
 
8a769a3
 
bc25ec1
 
3858edd
bc25ec1
 
 
3858edd
bc25ec1
3858edd
 
 
bc25ec1
 
8a769a3
 
 
 
 
3858edd
bc25ec1
8a769a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM python:3.10-slim

# Sistem bağımlılıkları ve temizlik
RUN apt-get update && \
    apt-get install -y --no-install-recommends git gcc python3-dev && \
    rm -rf /var/lib/apt/lists/* && \
    mkdir -p /tmp/huggingface /tmp/offload && \
    chmod 777 /tmp/huggingface /tmp/offload

# Çalışma dizini ve ortam değişkenleri
WORKDIR /app
ENV HF_HOME=/tmp/huggingface \
    TRANSFORMERS_CACHE=/tmp/huggingface \
    PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128

# Gerekli dosyaları kopyala
COPY requirements.txt .
COPY app.py .

# Bağımlılıkları yükle
RUN pip install --no-cache-dir -r requirements.txt && \
    if [ "$(uname -m)" = "x86_64" ]; then \
        pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu; \
    else \
        pip install --no-cache-dir torch; \
    fi

# Çalıştırma komutu
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]