Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +30 -4
Dockerfile
CHANGED
|
@@ -1,13 +1,39 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY requirements.txt .
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
|
|
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1-runtime-ubuntu22.04
|
| 2 |
|
| 3 |
+
# Set environment variables
|
| 4 |
+
ENV PYTHONUNBUFFERED=1
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV HF_HOME=/app/cache
|
| 7 |
+
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
python3 \
|
| 11 |
+
python3-pip \
|
| 12 |
+
python3-venv \
|
| 13 |
+
git \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
# Set working directory
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
+
# Copy requirements and install Python dependencies
|
| 20 |
COPY requirements.txt .
|
| 21 |
|
| 22 |
+
# Install Python dependencies
|
| 23 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
+
# Copy application code
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
+
# Create cache directory
|
| 29 |
+
RUN mkdir -p /app/cache
|
| 30 |
+
|
| 31 |
+
# Expose ports
|
| 32 |
+
EXPOSE 7860 5000
|
| 33 |
+
|
| 34 |
+
# Health check
|
| 35 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 36 |
+
CMD curl -f http://localhost:5000/health || exit 1
|
| 37 |
|
| 38 |
+
# Run both Gradio and Flask servers
|
| 39 |
+
CMD ["python3", "app.py"]
|