Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Base Python image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Environment settings to avoid Python cache & force unbuffered output
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Set working directory
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Install system dependencies (for building some Python packages)
|
| 12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
build-essential \
|
| 14 |
+
gcc \
|
| 15 |
+
g++ \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# Copy requirements first (better Docker caching)
|
| 19 |
+
COPY requirements.txt requirements.txt
|
| 20 |
+
|
| 21 |
+
# Install Python dependencies
|
| 22 |
+
RUN pip install --no-cache-dir -r requirements.txt gunicorn
|
| 23 |
+
|
| 24 |
+
# Copy the entire project (including subfolders)
|
| 25 |
+
COPY . .
|
| 26 |
+
|
| 27 |
+
# Hugging Face Spaces default exposed port
|
| 28 |
+
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
# Run Flask with Gunicorn for parallel processing
|
| 31 |
+
# app:app means 'app.py' file and 'app' Flask instance inside it
|
| 32 |
+
CMD ["gunicorn", "--workers", "4", "--threads", "12", "--bind", "0.0.0.0:7860", "app:app"]
|