Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +34 -36
Dockerfile
CHANGED
|
@@ -1,50 +1,48 @@
|
|
| 1 |
-
# Hugging Face
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
#
|
| 5 |
-
# nginx (:8000 = app_port) -> FastAPI voice app (:8001)
|
| 6 |
-
# -> Streamlit dashboard (:8501, under /dashboard)
|
| 7 |
-
# supervisord keeps all three processes alive.
|
| 8 |
-
|
| 9 |
FROM python:3.12
|
| 10 |
|
| 11 |
-
LABEL maintainer="
|
| 12 |
-
|
| 13 |
-
WORKDIR /workspace
|
| 14 |
|
| 15 |
-
|
| 16 |
-
RUN apt-get update && apt-get install -y \
|
| 17 |
git \
|
| 18 |
build-essential \
|
| 19 |
-
nginx \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
|
| 23 |
-
# mounted only for this step and is NOT baked into any image layer.
|
| 24 |
-
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
|
| 25 |
-
git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/saghir-abbasi/duct_z.git /workspace
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
# image-build time. `uv run ingest` also downloads the fastembed model
|
| 42 |
-
# (~110MB) into the cache, so the first runtime query is fast.
|
| 43 |
-
RUN uv run build_db
|
| 44 |
-
RUN uv run ingest
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
CMD ["/workspace/.venv/bin/supervisord", "-c", "/workspace/deploy/supervisord.conf"]
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Docker Space.
|
| 2 |
+
# Space settings -> Variables and secrets:
|
| 3 |
+
# GITHUB_TOKEN (secret, read access to the private repo; used at build time)
|
| 4 |
+
# OPENAI_API_KEY and the other .env values (secrets/variables, used at runtime)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
FROM python:3.12
|
| 6 |
|
| 7 |
+
LABEL maintainer="insurance_agent"
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 10 |
git \
|
| 11 |
build-essential \
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
RUN pip install --no-cache-dir uv
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
# Spaces run the container as UID 1000; build as that user so every file
|
| 17 |
+
# (profiles, active_profile.json, Chroma stores) is writable at runtime.
|
| 18 |
+
RUN useradd --create-home --uid 1000 user
|
| 19 |
+
USER user
|
| 20 |
|
| 21 |
+
ENV HOME=/home/user \
|
| 22 |
+
PATH=/home/user/app/.venv/bin:$PATH \
|
| 23 |
+
PYTHONUNBUFFERED=1 \
|
| 24 |
+
UV_LINK_MODE=copy \
|
| 25 |
+
FASTEMBED_CACHE_PATH=/home/user/app/.cache/fastembed
|
| 26 |
|
| 27 |
+
WORKDIR /home/user/app
|
| 28 |
+
|
| 29 |
+
# Bump to force a fresh clone when the Docker layer cache would reuse an old one.
|
| 30 |
+
ARG REPO_REVISION=1
|
| 31 |
+
|
| 32 |
+
# Use token to clone the private repo
|
| 33 |
+
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
|
| 34 |
+
git clone --depth 1 https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/saghir-abbasi/call_center_demo.git . \
|
| 35 |
+
&& rm -rf .git
|
| 36 |
|
| 37 |
+
RUN uv sync --frozen --no-dev
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
# Build the Chroma vector stores of every agent profile (data/profiles/*/knowledge.*)
|
| 40 |
+
# at image-build time. This also downloads the fastembed model (~110MB) into
|
| 41 |
+
# FASTEMBED_CACHE_PATH, so the first runtime call is fast.
|
| 42 |
+
RUN uv run --no-sync ingest --all
|
| 43 |
|
| 44 |
+
EXPOSE 7860
|
|
|
|
| 45 |
|
| 46 |
+
# The browser call page (/app) opens its WebSocket on whatever host served it,
|
| 47 |
+
# so no DOMAIN_URL override is needed for the port.
|
| 48 |
+
CMD ["uvicorn", "src.insurance_agent.main:app", "--host", "0.0.0.0", "--port", "7860"]
|