File size: 1,226 Bytes
92ed054
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ---- ① 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"]