musk12's picture
Update Dockerfile
2f37b8d verified
raw
history blame contribute delete
955 Bytes
# ───────────── 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"]