Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -7
Dockerfile
CHANGED
|
@@ -6,7 +6,7 @@ COPY requirements.txt .
|
|
| 6 |
|
| 7 |
RUN apt-get update && \
|
| 8 |
apt-get install -y --no-install-recommends gcc python3-dev && \
|
| 9 |
-
pip install --
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Stage 2: Runtime
|
|
@@ -14,15 +14,15 @@ FROM python:3.9-slim
|
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
COPY --from=builder /root/.cache /root/.cache
|
| 19 |
-
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
| 20 |
-
|
| 21 |
-
# Install runtime dependencies
|
| 22 |
RUN apt-get update && \
|
| 23 |
apt-get install -y --no-install-recommends libgomp1 && \
|
| 24 |
rm -rf /var/lib/apt/lists/*
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Copy application code
|
| 27 |
COPY app.py text2generation.py ./
|
| 28 |
|
|
@@ -33,5 +33,8 @@ EXPOSE 7860
|
|
| 33 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 \
|
| 34 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 35 |
|
| 36 |
-
#
|
|
|
|
|
|
|
|
|
|
| 37 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120", "app:app"]
|
|
|
|
| 6 |
|
| 7 |
RUN apt-get update && \
|
| 8 |
apt-get install -y --no-install-recommends gcc python3-dev && \
|
| 9 |
+
pip install --no-cache-dir -r requirements.txt gunicorn && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Stage 2: Runtime
|
|
|
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Install system dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN apt-get update && \
|
| 19 |
apt-get install -y --no-install-recommends libgomp1 && \
|
| 20 |
rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
+
# Copy Python dependencies (including gunicorn)
|
| 23 |
+
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
| 24 |
+
COPY --from=builder /usr/local/bin/gunicorn /usr/local/bin/
|
| 25 |
+
|
| 26 |
# Copy application code
|
| 27 |
COPY app.py text2generation.py ./
|
| 28 |
|
|
|
|
| 33 |
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 \
|
| 34 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 35 |
|
| 36 |
+
# Verify gunicorn is available
|
| 37 |
+
RUN which gunicorn && gunicorn --version
|
| 38 |
+
|
| 39 |
+
# Run with Gunicorn
|
| 40 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120", "app:app"]
|