Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +41 -0
Dockerfile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CPU-optimized base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
git \
|
| 10 |
+
wget \
|
| 11 |
+
libgl1-mesa-glx \
|
| 12 |
+
libglib2.0-0 \
|
| 13 |
+
libsm6 \
|
| 14 |
+
libxext6 \
|
| 15 |
+
libxrender-dev \
|
| 16 |
+
libgomp1 \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
# Copy requirements first (for better Docker caching)
|
| 20 |
+
COPY requirements.txt .
|
| 21 |
+
|
| 22 |
+
# Install Python dependencies in order (CPU versions)
|
| 23 |
+
RUN pip install --no-cache-dir numpy==1.26.4 && \
|
| 24 |
+
pip install --no-cache-dir scipy==1.11.4 && \
|
| 25 |
+
pip install --no-cache-dir scikit-learn==1.3.2 && \
|
| 26 |
+
pip install --no-cache-dir matplotlib==3.7.2 && \
|
| 27 |
+
pip install --no-cache-dir torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cpu && \
|
| 28 |
+
pip install --no-cache-dir -r requirements.txt
|
| 29 |
+
|
| 30 |
+
# Copy entire application
|
| 31 |
+
COPY . .
|
| 32 |
+
|
| 33 |
+
# Expose Gradio port
|
| 34 |
+
EXPOSE 7860
|
| 35 |
+
|
| 36 |
+
# Set environment variables
|
| 37 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 38 |
+
ENV GRADIO_SERVER_PORT=7860
|
| 39 |
+
|
| 40 |
+
# Run the app
|
| 41 |
+
CMD ["python", "app.py"]
|