Spaces:
Running
Running
Download deploy/hf/Dockerfile from Aynkhn/WorkPilot-AI: direct link, hf CLI and curl.
- Browser
- Download file 2.65 kB
-
https://huggingface.co/spaces/Aynkhn/WorkPilot-AI/resolve/main/deploy/hf/Dockerfile
- Command line
-
hf download hf://spaces/Aynkhn/WorkPilot-AI/deploy/hf/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Aynkhn/WorkPilot-AI/resolve/main/deploy/hf/Dockerfile
2.65 kB
| # syntax=docker/dockerfile:1.7 | |
| # WorkPilot as ONE container for a Hugging Face Docker Space (a public demo). | |
| # | |
| # A Space exposes a single port (7860) and has no persistent disk, so everything runs here: | |
| # embedded Postgres 16 + pgvector (pgserver), migrated and seeded with the demo tenant on | |
| # every start -> API (127.0.0.1:8000) + DBOS worker -> Next.js on :7860, which forwards | |
| # /backend/* to the API (web/next.config.ts, WP_BACKEND_PROXY). | |
| # deploy/hf/start.py supervises the processes. Model keys come from Space secrets. | |
| # Build context: the repository root (the publish workflow copies this file to /Dockerfile). | |
| # ---- web: Next.js standalone build, API reached through the same origin ----------------- | |
| FROM node:24-bookworm-slim AS web | |
| WORKDIR /web | |
| COPY web/package.json web/package-lock.json ./ | |
| RUN npm ci --no-audit --no-fund | |
| COPY web/ ./ | |
| # web/public may be empty, and empty folders are not uploaded to the Space. | |
| RUN mkdir -p public | |
| ENV NEXT_OUTPUT=standalone \ | |
| NEXT_TELEMETRY_DISABLED=1 \ | |
| NEXT_PUBLIC_API_URL=/backend \ | |
| WP_BACKEND_PROXY=http://127.0.0.1:8000 | |
| RUN npm run build | |
| # ---- python: the app + LLM providers + embedded Postgres ------------------------------- | |
| FROM python:3.12-slim-bookworm AS py | |
| ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 | |
| RUN python -m venv /opt/venv | |
| ENV PATH=/opt/venv/bin:$PATH | |
| WORKDIR /app | |
| COPY pyproject.toml README.md ./ | |
| COPY core ./core | |
| COPY packs ./packs | |
| COPY evals ./evals | |
| COPY mcp_servers ./mcp_servers | |
| # hadolint ignore=DL3013 | |
| RUN pip install --no-cache-dir ".[llm]" "pgserver>=0.1.4" | |
| # ---- runtime --------------------------------------------------------------------------- | |
| FROM python:3.12-slim-bookworm | |
| # libstdc++6: the node binary's runtime; libgomp1: LightGBM if it is ever added. | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends libstdc++6 libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && useradd --create-home --uid 1000 user | |
| COPY --from=web /usr/local/bin/node /usr/local/bin/node | |
| COPY --from=py /opt/venv /opt/venv | |
| WORKDIR /app | |
| COPY alembic.ini ./ | |
| COPY alembic ./alembic | |
| COPY core ./core | |
| COPY packs ./packs | |
| COPY evals ./evals | |
| COPY mcp_servers ./mcp_servers | |
| COPY deploy/scripts ./deploy/scripts | |
| COPY deploy/hf ./deploy/hf | |
| COPY --from=web /web/.next/standalone ./web | |
| COPY --from=web /web/.next/static ./web/.next/static | |
| COPY --from=web /web/public ./web/public | |
| # Hugging Face runs the container as uid 1000; Postgres refuses to run as root anyway. | |
| USER user | |
| ENV PATH=/opt/venv/bin:$PATH \ | |
| PYTHONPATH=/app \ | |
| PYTHONUNBUFFERED=1 \ | |
| HOME=/home/user \ | |
| WP_ENV=production | |
| EXPOSE 7860 | |
| CMD ["python", "deploy/hf/start.py"] | |