Spaces:
Running
Running
# ---- ① 先单独拉一个包含 uv/uvx 的阶段 ------------------- | |
FROM ghcr.io/astral-sh/uv:latest AS uvstage | |
# 它里面已经带 /uv /uvx 两个 ELF 可执行文件 | |
# ---- ② 主构建阶段:跟你现在的 node:20-slim 方案一致 ---- | |
FROM node:20-slim | |
# 系统工具 | |
RUN apt-get update && apt-get install -yqq --no-install-recommends \ | |
git python3 python3-pip coreutils socat \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Hugging Face Hub CLI | |
RUN pip3 install --no-cache-dir huggingface_hub --break-system-packages | |
# pnpm | |
RUN npm install -g pnpm | |
ENV PORT=7860 | |
# ----------- ③ 把真正的 uv / uvx 拷贝进来 --------------- | |
COPY --from=uvstage /uv /uvx /usr/local/bin/ | |
# 现在 `uv`、`uvx` 均为原生二进制,可直接使用 | |
# ----------- 以下保持和你目前一致 ----------------------- | |
ENV PNPM_HOME=/usr/local/share/pnpm | |
ENV PATH=$PNPM_HOME:$PATH | |
WORKDIR /app | |
RUN git config --global --add safe.directory /app | |
# 克隆、安装、构建 mcphub | |
RUN git clone https://github.com/samanhappy/mcphub.git . | |
RUN pnpm install | |
RUN npm run build | |
# 启动脚本 | |
COPY start.sh /app/start.sh | |
RUN chmod +x /app/start.sh | |
EXPOSE 7860 | |
CMD ["/app/start.sh"] |