MCPHub / Dockerfile
alpgul's picture
Create Dockerfile
92ed054 verified
Raw
History Blame Contribute Delete
1.23 kB
# ---- ① First, pull a stage that includes uv/uvx separately -------------------
FROM ghcr.io/astral-sh/uv:latest AS uvstage
# It already contains two ELF executable files: /uv and /uvx
# ---- ② Main build stage: consistent with your current node:20-slim solution ----
FROM node:20-slim
# System tools
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
# ----------- ③ Copy the real uv / uvx in ---------------
COPY --from=uvstage /uv /uvx /usr/local/bin/
# Now `uv` and `uvx` are native binaries and can be used directly
# ----------- The following remains consistent with your current setup -----------------------
ENV PNPM_HOME=/usr/local/share/pnpm
ENV PATH=$PNPM_HOME:$PATH
WORKDIR /app
RUN git config --global --add safe.directory /app
# Clone, install, and build mcphub
RUN git clone https://github.com/samanhappy/mcphub.git .
RUN pnpm install
RUN npm run build
# Startup script
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
EXPOSE 7860
CMD ["/app/start.sh"]