Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -3
Dockerfile
CHANGED
|
@@ -2,19 +2,22 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
build-essential \
|
| 8 |
whois \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
COPY requirements.txt .
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
ENV PORT=7860
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
-
# Added --timeout 120 to allow up to 2 minutes for heavy ML models to load smoothly
|
| 20 |
CMD ["gunicorn", "app:app", "--workers", "1", "--timeout", "120", "--bind", "0.0.0.0:7860"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies and force-install gunicorn and flask up front
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
build-essential \
|
| 8 |
whois \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
COPY requirements.txt .
|
| 12 |
+
|
| 13 |
+
# Upgrade pip and install packages cleanly
|
| 14 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 15 |
+
pip install --no-cache-dir gunicorn flask flask-cors && \
|
| 16 |
+
pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
ENV PORT=7860
|
| 21 |
EXPOSE 7860
|
| 22 |
|
|
|
|
| 23 |
CMD ["gunicorn", "app:app", "--workers", "1", "--timeout", "120", "--bind", "0.0.0.0:7860"]
|