File size: 955 Bytes
90d68cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e3ed663
90d68cb
2f37b8d
 
 
90d68cb
768f908
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
# ───────────── Dockerfile ─────────────

# Use official PyTorch image with CUDA (change 11.8 if needed)
FROM pytorch/pytorch:2.2.0-cuda11.8-cudnn8-runtime

# Set working directory
WORKDIR /app

COPY . /app

# Install Python dependencies
RUN apt-get update && apt-get install -y \
        git \
        ffmpeg \
        libgl1-mesa-glx \
        && rm -rf /var/lib/apt/lists/*

# Install Python packages
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir \
        fastapi[all] \
        uvicorn[standard] \
        pillow \
        faiss-cpu \
        pyarrow \
        datasets \
        torchvision \
        numpy

# Expose port for FastAPI
EXPOSE 7860

# Healthcheck so HF knows app is ready
HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1

# Command to run the FastAPI server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]