Spaces:
Running
Running
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +48 -29
Dockerfile
CHANGED
|
@@ -1,41 +1,60 @@
|
|
| 1 |
-
#
|
| 2 |
#
|
| 3 |
-
#
|
| 4 |
-
#
|
| 5 |
-
#
|
| 6 |
#
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
# github.com/rockerritesh/sumit-mcp-server (private)
|
| 10 |
#
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 17 |
-
RUN apt-get update && \
|
| 18 |
-
apt-get install -y --no-install-recommends git ca-certificates && \
|
| 19 |
-
rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
WORKDIR /app
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
"https://x-access-token:${GITHUB_TOKEN}@github.com/rockerritesh/sumit-mcp-server.git" \
|
| 28 |
-
. && \
|
| 29 |
-
git log -1 --pretty=format:"source: %H %s%n" > /app/BUILD_INFO
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
RUN mkdir -p /app/.cache/uv && chmod -R 777 /app/.cache
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# All-in-one Tatva deployment for a SINGLE Hugging Face Space.
|
| 2 |
#
|
| 3 |
+
# Clones the private monorepo with a GitHub PAT (build secret GITHUB_TOKEN),
|
| 4 |
+
# builds the Next.js dashboard, installs the MCP server + FastAPI control plane,
|
| 5 |
+
# and runs all of them behind nginx on port 7860 via supervisord.
|
| 6 |
#
|
| 7 |
+
# This file is self-contained (it clones rather than COPYs) so it can be the
|
| 8 |
+
# root Dockerfile of a thin HF Space — the same pattern as `sumit-server`.
|
|
|
|
| 9 |
#
|
| 10 |
+
# Build (local):
|
| 11 |
+
# echo -n "$GITHUB_PAT" | docker build -f deploy/Dockerfile \
|
| 12 |
+
# --secret id=GITHUB_TOKEN,src=/dev/stdin -t tatva-aio .
|
| 13 |
+
# HF Space: add a Space secret GITHUB_TOKEN; HF passes it as a build secret.
|
| 14 |
|
| 15 |
+
ARG REPO=github.com/rockerritesh/sumit-mcp-server.git
|
| 16 |
+
|
| 17 |
+
# ---------- stage 1: build the Next.js dashboard ----------
|
| 18 |
+
FROM node:20-slim AS web
|
| 19 |
+
ARG REPO
|
| 20 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 21 |
+
WORKDIR /src
|
| 22 |
+
RUN --mount=type=secret,id=GITHUB_TOKEN \
|
| 23 |
+
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@${REPO} .
|
| 24 |
+
WORKDIR /src/portal/web
|
| 25 |
+
RUN npm install --legacy-peer-deps && npm run build
|
| 26 |
|
| 27 |
+
# ---------- stage 2: runtime (python + node + nginx + supervisor) ----------
|
| 28 |
+
FROM python:3.13-slim
|
| 29 |
+
ARG REPO
|
| 30 |
+
RUN apt-get update \
|
| 31 |
+
&& apt-get install -y git nginx supervisor curl ca-certificates \
|
| 32 |
+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 33 |
+
&& apt-get install -y nodejs \
|
| 34 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
WORKDIR /app
|
| 38 |
+
RUN --mount=type=secret,id=GITHUB_TOKEN \
|
| 39 |
+
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@${REPO} .
|
| 40 |
|
| 41 |
+
# MCP server deps (repo root) + control-plane deps (portal/api)
|
| 42 |
+
ENV UV_CACHE_DIR=/app/.cache/uv
|
| 43 |
+
RUN uv sync --no-dev \
|
| 44 |
+
&& cd portal/api && uv sync --no-dev
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
# Next.js standalone server from the build stage (tracing root pinned to web/,
|
| 47 |
+
# so server.js + node_modules sit at .next/standalone/).
|
| 48 |
+
COPY --from=web /src/portal/web/.next/standalone/ /app/portal/web/
|
| 49 |
+
COPY --from=web /src/portal/web/.next/static /app/portal/web/.next/static
|
| 50 |
+
COPY --from=web /src/portal/web/public /app/portal/web/public
|
| 51 |
|
| 52 |
+
# Process + proxy config (from the cloned repo)
|
| 53 |
+
RUN cp deploy/nginx.conf /etc/nginx/nginx.conf \
|
| 54 |
+
&& cp deploy/supervisord.conf /etc/supervisor/conf.d/tatva.conf \
|
| 55 |
+
&& mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
|
|
|
| 56 |
|
| 57 |
+
# Control-plane + MCP read all other config (MONGO_URI, JWT_SECRET, QDRANT_*,
|
| 58 |
+
# PLATFORM_ADMINS, STRIPE_*) from Space secrets injected as env vars at runtime.
|
| 59 |
+
EXPOSE 7860
|
| 60 |
+
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/tatva.conf"]
|