Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -47
Dockerfile
CHANGED
|
@@ -1,47 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
libgl1-mesa-glx \
|
| 12 |
-
libglib2.0-0 \
|
| 13 |
-
libsm6 \
|
| 14 |
-
libxext6 \
|
| 15 |
-
libxrender-dev \
|
| 16 |
-
libgomp1 \
|
| 17 |
-
curl \
|
| 18 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
-
|
| 20 |
-
# Copy requirements first for better caching
|
| 21 |
-
COPY requirements.txt .
|
| 22 |
-
|
| 23 |
-
# Install Python dependencies
|
| 24 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
-
|
| 26 |
-
# Create models directory
|
| 27 |
-
RUN mkdir -p /app/models
|
| 28 |
-
|
| 29 |
-
# Copy model files
|
| 30 |
-
COPY *.safetensors /app/models/
|
| 31 |
-
|
| 32 |
-
# Copy application code
|
| 33 |
-
COPY app.py .
|
| 34 |
-
|
| 35 |
-
# Create a non-root user for security
|
| 36 |
-
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
| 37 |
-
USER appuser
|
| 38 |
-
|
| 39 |
-
# Expose port (Hugging Face Spaces uses port 7860)
|
| 40 |
-
EXPOSE 7860
|
| 41 |
-
|
| 42 |
-
# Health check
|
| 43 |
-
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
| 44 |
-
CMD curl -f http://localhost:7860/health || exit 1
|
| 45 |
-
|
| 46 |
-
# Run the application
|
| 47 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
COPY . /app
|
| 5 |
+
|
| 6 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
+
|
| 8 |
+
EXPOSE 7860
|
| 9 |
+
|
| 10 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|