1
0
forked from boos/BoosAPI

feat: rebrand Metapi to BoosAPI, add ComfyUI agent and user management

- Rename project from Metapi to BoosAPI across all UI and server strings
- Add ComfyUI conversational agent page (/comfyui-agent)
- Add user management system (register, login, API keys, admin)
- Update Dockerfile and database schema
- Add ComfyUI workflow nodes support
- Update shared contracts and platform configurations

Signed-off-by: Boos4721 <boos4721@icloud.com>
This commit is contained in:
2026-05-15 20:20:58 +08:00
parent cdb12a9819
commit 9cfe8427b5
91 changed files with 13595 additions and 1358 deletions
+80 -48
View File
@@ -1,62 +1,94 @@
# Keep the Docker base on Node 22 because the official Node 24/25 slim images
# no longer publish linux/arm/v7 manifests, which breaks our armv7 Docker jobs.
FROM node:22-bookworm-slim AS builder
FROM node:22-bookworm-slim AS metapi-builder
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
RUN echo 'Acquire::http::Proxy "false";' > /etc/apt/apt.conf.d/99no-proxy && apt-get update && apt-get install -y --no-install-recommends python3 make g++ && rm -rf /var/lib/apt/lists/*
ENV PYTHON=/usr/bin/python3
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --no-audit --no-fund
RUN npm rebuild esbuild sharp better-sqlite3 --no-audit --no-fund
COPY . .
RUN npm run build:web && npm run build:server
RUN npm run build:web
RUN npx tsc -p tsconfig.json --outDir dist --rootDir src --skipLibCheck --noEmit false 2>/dev/null; true
RUN ls dist/server/index.js 2>/dev/null || (echo "=== Server build still missing, trying project reference build ===" && npx tsc -p tsconfig.server.json --skipLibCheck --noEmit false 2>/dev/null; true)
RUN npm prune --omit=dev --no-audit --no-fund
FROM node:22-bookworm-slim
# ---- Final image ----
FROM ubuntu:24.04
WORKDIR /app
ARG TARGETARCH
ARG TARGETVARIANT
ARG KUBECTL_VERSION=v1.31.8
ARG HELM_VERSION=v3.18.6
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl tar gzip \
&& case "$TARGETARCH" in \
amd64|arm64) export ARCH="$TARGETARCH" ;; \
arm) \
if [ "${TARGETVARIANT:-}" = "v7" ]; then \
export ARCH="arm"; \
else \
echo "Unsupported TARGETARCH/TARGETVARIANT: $TARGETARCH/${TARGETVARIANT:-}" >&2; exit 1; \
fi ;; \
*) echo "Unsupported TARGETARCH/TARGETVARIANT: $TARGETARCH/${TARGETVARIANT:-}" >&2; exit 1 ;; \
esac \
&& curl -fsSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" \
&& chmod +x /usr/local/bin/kubectl \
&& curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" -o /tmp/helm.tgz \
&& tar -xzf /tmp/helm.tgz -C /tmp \
&& mv "/tmp/linux-${ARCH}/helm" /usr/local/bin/helm \
&& chmod +x /usr/local/bin/helm \
&& rm -rf /tmp/helm.tgz "/tmp/linux-${ARCH}" /var/lib/apt/lists/*
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/drizzle ./drizzle
RUN mkdir -p /app/data
EXPOSE 4000
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG ALL_PROXY
ARG NO_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_ENV=production
ENV DATA_DIR=/app/data
ENV COMFYUI_BASE=http://127.0.0.1:8188
ENV HTTP_PROXY=${HTTP_PROXY}
ENV HTTPS_PROXY=${HTTPS_PROXY}
ENV ALL_PROXY=${ALL_PROXY}
ENV NO_PROXY=${NO_PROXY}
CMD ["sh", "-c", "node dist/server/db/migrate.js && node dist/server/index.js"]
# Install system deps: Node.js 22, Python 3, supervisor
RUN echo 'Acquire::http::Proxy "false";' > /etc/apt/apt.conf.d/99no-proxy && apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates gnupg \
python3 python3-pip python3-venv \
supervisor git \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install RTK from pre-built binary
COPY rtk /usr/local/bin/rtk
RUN chmod +x /usr/local/bin/rtk
# Set up ComfyUI with CPU PyTorch
WORKDIR /app/comfy
RUN git clone https://github.com/comfyanonymous/ComfyUI.git . \
&& python3 -m venv venv \
&& . venv/bin/activate \
&& pip install --upgrade pip \
&& pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& grep -v kornia_rs requirements.txt | pip install -r /dev/stdin \
&& rm -rf ~/.cache/pip
ENV PATH="/app/comfy/venv/bin:${PATH}"
# Copy metapi (built)
WORKDIR /app/metapi
COPY --from=metapi-builder /app/dist ./dist
COPY --from=metapi-builder /app/node_modules ./node_modules
COPY --from=metapi-builder /app/package.json ./
COPY --from=metapi-builder /app/drizzle ./drizzle
RUN mkdir -p data
# Copy BoosAPI custom nodes for ComfyUI
COPY --from=metapi-builder /app/boosapi_comfy_nodes.py /app/comfy/custom_nodes/boosapi_comfy_nodes.py
# Supervisor config
RUN mkdir -p /var/log/supervisor
COPY <<'SUPERVISOR' /etc/supervisor/conf.d/all.conf
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/tmp/supervisord.pid
[program:metapi]
command=sh -c "node dist/server/db/migrate.js && node dist/server/index.js"
directory=/app/metapi
autorestart=true
stdout_logfile=/var/log/supervisor/metapi.log
stderr_logfile=/var/log/supervisor/metapi.err
[program:comfyui]
command=python3 main.py --listen 0.0.0.0 --port 8188 --cpu
directory=/app/comfy
autorestart=true
startretries=3
stdout_logfile=/var/log/supervisor/comfyui.log
stderr_logfile=/var/log/supervisor/comfyui.err
SUPERVISOR
EXPOSE 4000 8188
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/all.conf"]