Update Dockerfile
Browse files- Dockerfile +8 -12
Dockerfile
CHANGED
|
@@ -1,29 +1,25 @@
|
|
| 1 |
-
# ---- Base image ----
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# ---- Workdir ----
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
-
#
|
| 15 |
COPY requirements.txt /app/
|
| 16 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 17 |
&& pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
#
|
| 20 |
COPY . /app
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
# Hugging Face sets $PORT for you; default to 7860 for local dev
|
| 24 |
ENV PORT=7860
|
| 25 |
EXPOSE 7860
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
# 1 worker + 2 threads is enough for CPU Spaces; adjust if needed
|
| 29 |
CMD ["bash", "-lc", "gunicorn app:app --bind 0.0.0.0:${PORT} --workers 1 --threads 2 --timeout 120 --log-level info"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Runtime libs for numpy/scipy/sklearn wheels on Debian trixie
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
libgomp1 \
|
| 6 |
+
libgfortran5 \
|
| 7 |
+
libopenblas0 \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Install Python deps first for better caching
|
| 13 |
COPY requirements.txt /app/
|
| 14 |
RUN pip install --no-cache-dir --upgrade pip \
|
| 15 |
&& pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Copy app code
|
| 18 |
COPY . /app
|
| 19 |
|
| 20 |
+
# Hugging Face sets $PORT; default helps local dev
|
|
|
|
| 21 |
ENV PORT=7860
|
| 22 |
EXPOSE 7860
|
| 23 |
|
| 24 |
+
# Bind gunicorn to $PORT so Spaces health-checks pass
|
|
|
|
| 25 |
CMD ["bash", "-lc", "gunicorn app:app --bind 0.0.0.0:${PORT} --workers 1 --threads 2 --timeout 120 --log-level info"]
|