Spaces:
Sleeping
Sleeping
Melika Kheirieh
commited on
Commit
·
adb02fa
1
Parent(s):
f188061
fix(docker): hybrid startup for FastAPI + Gradio with HF healthcheck
Browse files- Dockerfile +5 -4
Dockerfile
CHANGED
|
@@ -6,7 +6,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 6 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
| 8 |
|
| 9 |
-
# ----------
|
| 10 |
COPY requirements.txt .
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends curl && \
|
| 12 |
pip install --no-cache-dir -r requirements.txt && \
|
|
@@ -15,13 +15,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl && \
|
|
| 15 |
# ---------- Copy app ----------
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
# ---------- Metadata
|
| 19 |
LABEL org.opencontainers.image.title="nl2sql-copilot" \
|
| 20 |
-
org.opencontainers.image.description="
|
| 21 |
org.opencontainers.image.version="1.0.0"
|
| 22 |
|
|
|
|
| 23 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
| 24 |
-
CMD curl -fs http://localhost:
|
| 25 |
|
| 26 |
# ---------- Run both backend & frontend ----------
|
| 27 |
EXPOSE 7860 8000
|
|
|
|
| 6 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
PIP_NO_CACHE_DIR=1
|
| 8 |
|
| 9 |
+
# ---------- Install dependencies ----------
|
| 10 |
COPY requirements.txt .
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends curl && \
|
| 12 |
pip install --no-cache-dir -r requirements.txt && \
|
|
|
|
| 15 |
# ---------- Copy app ----------
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
# ---------- Metadata ----------
|
| 19 |
LABEL org.opencontainers.image.title="nl2sql-copilot" \
|
| 20 |
+
org.opencontainers.image.description="Hybrid FastAPI + Gradio demo for Hugging Face Spaces" \
|
| 21 |
org.opencontainers.image.version="1.0.0"
|
| 22 |
|
| 23 |
+
# ---------- Healthcheck ----------
|
| 24 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
| 25 |
+
CMD curl -fs http://localhost:7860/ || exit 1
|
| 26 |
|
| 27 |
# ---------- Run both backend & frontend ----------
|
| 28 |
EXPOSE 7860 8000
|