Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
COPY . .
|
| 5 |
+
|
| 6 |
+
# Install system packages
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
git \
|
| 9 |
+
ffmpeg \
|
| 10 |
+
libsm6 \
|
| 11 |
+
libxext6 \
|
| 12 |
+
g++ \
|
| 13 |
+
build-essential \
|
| 14 |
+
cmake \
|
| 15 |
+
python3-dev \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# Upgrade pip
|
| 19 |
+
RUN pip install --upgrade pip
|
| 20 |
+
|
| 21 |
+
# Install PyTorch (CPU version)
|
| 22 |
+
RUN pip install torch==2.1.0+cpu torchvision==0.16.0+cpu --index-url https://download.pytorch.org/whl/cpu
|
| 23 |
+
|
| 24 |
+
# Install Python dependencies
|
| 25 |
+
RUN pip install -r requirements.txt
|
| 26 |
+
|
| 27 |
+
# Install Detectron2 from GitHub
|
| 28 |
+
RUN pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 29 |
+
|
| 30 |
+
# Expose FastAPI port
|
| 31 |
+
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
# Start the app
|
| 34 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|