Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use NVIDIA CUDA base for GPU support (HF Spaces provides T4 GPU)
|
| 2 |
+
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies (Python, git, etc.)
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
python3.10 \
|
| 10 |
+
python3-pip \
|
| 11 |
+
git \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# Upgrade pip
|
| 15 |
+
RUN python3 -m pip install --upgrade pip
|
| 16 |
+
|
| 17 |
+
# Copy requirements and install Python deps
|
| 18 |
+
COPY requirements.txt .
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Copy app code
|
| 22 |
+
COPY app.py .
|
| 23 |
+
|
| 24 |
+
# Expose port (HF Spaces default)
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
|
| 27 |
+
# Run the FastAPI app with Uvicorn (workers=1 for single GPU, host=0.0.0.0 for external access)
|
| 28 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|