Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +5 -27
Dockerfile
CHANGED
|
@@ -1,42 +1,20 @@
|
|
| 1 |
-
# Use the specific Python version you requested
|
| 2 |
-
FROM python:3.14.3-slim
|
| 3 |
-
|
| 4 |
-
# Set the working directory in the container
|
| 5 |
-
WORKDIR /code
|
| 6 |
-
|
| 7 |
-
# Copy the requirements file first to leverage Docker caching
|
| 8 |
-
COPY requirements.txt .
|
| 9 |
-
|
| 10 |
-
# Install dependencies
|
| 11 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 12 |
-
|
| 13 |
-
# Copy the rest of the application code
|
| 14 |
-
COPY . .
|
| 15 |
-
|
| 16 |
-
# Hugging Face Spaces requires the app to run on port 7860
|
| 17 |
-
# We use Gunicorn for a stable production server
|
| 18 |
-
# 'server:app' assumes your Flask object is named 'app' inside 'server.py'
|
| 19 |
-
CMD ["gunicorn", "-b", "0.0.0.0:7860", "server:app"]
|
| 20 |
-
# Use the current Python 3.14 stable image
|
| 21 |
FROM python:3.14-slim
|
| 22 |
|
| 23 |
-
# Set the working directory
|
| 24 |
WORKDIR /code
|
| 25 |
|
| 26 |
-
#
|
| 27 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 28 |
libgomp1 \
|
|
|
|
|
|
|
| 29 |
&& rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
# Copy requirements
|
| 32 |
COPY requirements.txt .
|
| 33 |
|
| 34 |
-
#
|
| 35 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 36 |
|
| 37 |
-
# Copy your server.py and other files
|
| 38 |
COPY . .
|
| 39 |
|
| 40 |
-
# Launch with Gunicorn
|
| 41 |
-
# Note: Ensure 'gunicorn' was added to your requirements.txt
|
| 42 |
CMD ["gunicorn", "--timeout", "120", "-b", "0.0.0.0:7860", "server:app"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.14-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
+
# Install a more comprehensive set of system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
build-essential \
|
| 8 |
libgomp1 \
|
| 9 |
+
libmagic1 \
|
| 10 |
+
python3-dev \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
| 13 |
COPY requirements.txt .
|
| 14 |
|
| 15 |
+
# Try installing with a slightly higher timeout to prevent network drops
|
| 16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
|
|
|
|
| 18 |
COPY . .
|
| 19 |
|
|
|
|
|
|
|
| 20 |
CMD ["gunicorn", "--timeout", "120", "-b", "0.0.0.0:7860", "server:app"]
|