File size: 1,185 Bytes
9c1053c
 
 
 
fafd718
c5ed719
6c8e35b
c5ed719
 
 
6c8e35b
c5ed719
 
 
 
fafd718
9c1053c
c5ed719
fafd718
9c1053c
 
fafd718
 
 
 
 
 
 
 
 
 
c5ed719
 
fafd718
c5ed719
9c1053c
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender1 \
    libgomp1 \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements.txt .

# Install base dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Install CPU-only PyTorch (from official source)
RUN pip install --no-cache-dir torch==2.0.1 --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cpu

# Install Hugging Face ecosystem with compatible versions
RUN pip install --no-cache-dir transformers==4.30.2
RUN pip install --no-cache-dir sentence-transformers==2.2.2
RUN pip install --no-cache-dir accelerate==0.21.0
RUN pip install --no-cache-dir tokenizers==0.13.3
RUN pip install --no-cache-dir huggingface-hub==0.16.4

# Install remaining packages
RUN pip install --no-cache-dir scikit-image==0.21.0 scipy==1.10.1 httpx==0.24.1 aiofiles==23.2.1

COPY . .

EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]