2026-05-03 01:43:50 +02:00
|
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
|
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
|
PATH="/app/.venv/bin:${PATH}"
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
&& pip install --no-cache-dir uv
|
|
|
|
|
|
|
|
|
|
COPY pyproject.toml ./
|
|
|
|
|
|
2026-07-06 18:32:02 +02:00
|
|
|
# Bump DEPS_LOCK_ID when dependency wiring changes (busts DinD layer cache).
|
|
|
|
|
ARG DEPS_LOCK_ID=2
|
2026-07-06 18:36:09 +02:00
|
|
|
RUN echo "deps-lock=${DEPS_LOCK_ID}" && python - <<'PY' > /tmp/requirements.txt
|
2026-07-06 18:32:02 +02:00
|
|
|
import sys
|
2026-05-03 01:43:50 +02:00
|
|
|
import tomllib
|
|
|
|
|
|
|
|
|
|
with open("pyproject.toml", "rb") as f:
|
|
|
|
|
project = tomllib.load(f)["project"]
|
|
|
|
|
|
2026-07-06 18:32:02 +02:00
|
|
|
deps = project.get("dependencies") or []
|
|
|
|
|
if not deps:
|
|
|
|
|
sys.exit("pyproject.toml has no dependencies")
|
|
|
|
|
|
|
|
|
|
for dep in deps:
|
2026-06-25 14:01:10 +02:00
|
|
|
# llm-connect is a local editable test integration and must not be pulled
|
|
|
|
|
# into the production image. hub-core is runtime code, but it is installed
|
|
|
|
|
# from the named Docker build context below because it is not published yet.
|
|
|
|
|
if dep in {"llm-connect", "hub-core"}:
|
2026-05-03 01:43:50 +02:00
|
|
|
continue
|
|
|
|
|
print(dep)
|
|
|
|
|
PY
|
2026-07-06 18:32:02 +02:00
|
|
|
RUN test -s /tmp/requirements.txt
|
2026-05-03 01:43:50 +02:00
|
|
|
|
|
|
|
|
RUN uv venv /app/.venv \
|
|
|
|
|
&& uv pip install --python /app/.venv/bin/python --no-cache -r /tmp/requirements.txt
|
|
|
|
|
|
2026-06-25 14:01:10 +02:00
|
|
|
COPY --from=hub_core_src pyproject.toml /tmp/hub-core/pyproject.toml
|
|
|
|
|
COPY --from=hub_core_src hub_core/ /tmp/hub-core/hub_core/
|
|
|
|
|
|
|
|
|
|
RUN uv pip install --python /app/.venv/bin/python --no-cache /tmp/hub-core
|
|
|
|
|
|
2026-07-06 18:28:11 +02:00
|
|
|
RUN test -s /tmp/requirements.txt \
|
|
|
|
|
&& /app/.venv/bin/python -c "import asyncpg"
|
|
|
|
|
|
2026-05-03 01:43:50 +02:00
|
|
|
COPY alembic.ini ./
|
|
|
|
|
COPY api/ ./api/
|
|
|
|
|
COPY flows/ ./flows/
|
|
|
|
|
COPY mcp_server/ ./mcp_server/
|
|
|
|
|
COPY migrations/ ./migrations/
|
|
|
|
|
COPY policies/ ./policies/
|
|
|
|
|
COPY prompts/ ./prompts/
|
|
|
|
|
COPY scripts/ ./scripts/
|
|
|
|
|
COPY task_flow_engine/ ./task_flow_engine/
|
|
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
|
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/state/health', timeout=3).read()"
|
|
|
|
|
|
|
|
|
|
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]
|