refactor: purge Node.js, Rust is the one true backend

- Moved boosapi-rs/* to repo root
- Deleted all Node.js source (src/server/, src/web/, scripts/)
- Deleted node_modules, package.json, tsconfig, vite.config
- Updated .gitignore and AGENTS.md for Rust-only stack
- Fixed static file path for frontend dist/web/
- Dockerfile stays the same (already Rust-only)
- Kept dist/web/ for Rust static serving
This commit is contained in:
boos
2026-05-18 09:11:29 +08:00
parent 725f44699a
commit 5d29f03d50
1165 changed files with 271 additions and 323571 deletions
+14 -100
View File
@@ -1,102 +1,16 @@
FROM ubuntu:24.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_VERSION=22
# Base deps
RUN apt-get update && apt-get install -y \
curl git build-essential pkg-config libssl-dev \
python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
# Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
# Rust (for RTK)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# ========== RTK ==========
FROM base AS rtk-builder
WORKDIR /build
RUN git clone https://github.com/rtk-ai/rtk.git && cd rtk && cargo build --release
RUN cp /build/rtk/target/release/rtk /usr/local/bin/rtk
# ========== ComfyUI ==========
FROM base AS comfyui
WORKDIR /app/comfy
RUN git clone https://github.com/comfyanonymous/ComfyUI.git .
RUN python3 -m venv venv \
&& . venv/bin/activate \
&& pip install --upgrade pip \
&& pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu \
&& pip install -r requirements.txt \
&& pip install comfy-cli
ENV PATH="/app/comfy/venv/bin:${PATH}"
# ========== Metapi ==========
FROM base AS boosapi
WORKDIR /app/boosapi
FROM rust:1.83-alpine AS builder
RUN apk add --no-cache musl-dev pkgconfig openssl-dev
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release 2>/dev/null || true
COPY . .
RUN npm install
RUN npm run build --if-present
RUN cargo build --release
# ========== Final ==========
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
curl python3 python3-pip python3-venv nodejs \
ca-certificates supervisor \
&& rm -rf /var/lib/apt/lists/*
# Copy components
COPY --from=rtk-builder /usr/local/bin/rtk /usr/local/bin/rtk
COPY --from=comfyui /app/comfy /app/comfy
COPY --from=comfyui /app/comfy/venv /app/comfy/venv
COPY --from=boosapi /app/boosapi /app/boosapi
COPY --from=boosapi /usr/lib/node_modules /usr/lib/node_modules
# Node path
ENV PATH="/app/comfy/venv/bin:/usr/local/bin:${PATH}"
ENV COMFYUI_BASE=http://127.0.0.1:8188
ENV AUTH_TOKEN=change-me-admin-token
WORKDIR /app/boosapi
# Supervisor config
RUN mkdir -p /var/log/supervisor
COPY <<'EOF' /etc/supervisor/conf.d/all.conf
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/tmp/supervisord.pid
[program:boosapi-server]
command=npm run dev:server
directory=/app/boosapi
autorestart=true
stdout_logfile=/var/log/supervisor/boosapi-server.log
stderr_logfile=/var/log/supervisor/boosapi-server.err
[program:boosapi-web]
command=npx vite --host 0.0.0.0 --port 5173
directory=/app/boosapi
autorestart=true
stdout_logfile=/var/log/supervisor/boosapi-web.log
stderr_logfile=/var/log/supervisor/boosapi-web.err
[program:comfyui]
command=python3 main.py --listen 0.0.0.0 --port 8188
directory=/app/comfy
autorestart=true
stdout_logfile=/var/log/supervisor/comfyui.log
stderr_logfile=/var/log/supervisor/comfyui.err
EOF
EXPOSE 4000 5173 8188
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/all.conf"]
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata sqlite-libs
WORKDIR /app
COPY --from=builder /app/target/release/boosapi .
COPY --from=builder /app/migrations ./migrations
EXPOSE 4000
CMD ["./boosapi"]