Spaces:
Runtime error
Runtime error
Update dockerfile
Browse files- dockerfile +17 -1
dockerfile
CHANGED
|
@@ -1,12 +1,28 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY requirements.txt .
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
|
|
|
|
| 8 |
COPY app.py .
|
| 9 |
|
|
|
|
| 10 |
EXPOSE 8000
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies for faiss-cpu and pypdf
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
build-essential \
|
| 6 |
+
libffi-dev \
|
| 7 |
+
libssl-dev \
|
| 8 |
+
&& apt-get clean \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
# Copy and install requirements
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Copy application code
|
| 18 |
COPY app.py .
|
| 19 |
|
| 20 |
+
# Expose port 8000
|
| 21 |
EXPOSE 8000
|
| 22 |
|
| 23 |
+
# Health check to ensure the app is running
|
| 24 |
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 25 |
+
CMD curl -f http://localhost:8000/health || exit 1
|
| 26 |
+
|
| 27 |
+
# Run gunicorn with FastAPI
|
| 28 |
+
CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "app:app", "--bind", "0.0.0.0:8000", "--log-level", "info", "--timeout", "120"]
|