Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +29 -11
Dockerfile
CHANGED
|
@@ -1,11 +1,29 @@
|
|
| 1 |
-
FROM python:3.9
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim-bookworm
|
| 2 |
+
|
| 3 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
+
PYTHONUNBUFFERED=1 \
|
| 5 |
+
PIP_NO_CACHE_DIR=1
|
| 6 |
+
|
| 7 |
+
# Create non-root user
|
| 8 |
+
RUN useradd -m -u 1000 app
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Install Python deps first for caching
|
| 12 |
+
COPY requirements.txt .
|
| 13 |
+
RUN python -m pip install --upgrade pip \
|
| 14 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Copy app code and set ownership
|
| 17 |
+
COPY --chown=app:app . .
|
| 18 |
+
USER app
|
| 19 |
+
|
| 20 |
+
# Hugging Face Spaces listens on this port by default
|
| 21 |
+
ENV PORT=7860
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
# Healthcheck
|
| 25 |
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
| 26 |
+
CMD curl -fsS http://127.0.0.1:${PORT}/ || exit 1
|
| 27 |
+
|
| 28 |
+
# Run Chainlit
|
| 29 |
+
CMD ["sh", "-c", "chainlit run app.py --headless --host 0.0.0.0 --port ${PORT}"]
|