mirror of
https://github.com/open-webui/mcpo.git
synced 2026-11-24 06:20:21 -05:00
The image installed mcpo without the lock file, so every build pulled the newest releases of its dependencies. With the current MCP SDK and FastAPI releases, an image built from dev crashed at startup, first with an import error from the MCP SDK and then with a FastAPI error. The image now installs the exact versions from the lock file, like the development setup does, and an image built this way starts and answers tool calls again. Installs through pip or uvx do not use the lock file and still need their own fix.
46 lines
1.2 KiB
Docker
46 lines
1.2 KiB
Docker
FROM python:3.12-slim-bookworm
|
|
|
|
# Install uv (from official binary), nodejs, npm, and git
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git \
|
|
curl \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Node.js and npm via NodeSource
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Confirm npm and node versions (optional debugging info)
|
|
RUN node -v && npm -v
|
|
|
|
# Copy your mcpo source code (assuming in src/mcpo)
|
|
COPY . /app
|
|
WORKDIR /app
|
|
|
|
# Create virtual environment explicitly in known location
|
|
ENV VIRTUAL_ENV=/app/.venv
|
|
RUN uv venv "$VIRTUAL_ENV"
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
# Install mcpo (assuming pyproject.toml is properly configured)
|
|
RUN uv sync --frozen --no-dev && rm -rf ~/.cache
|
|
|
|
# Verify mcpo installed correctly
|
|
RUN which mcpo
|
|
|
|
# Run as an unprivileged user
|
|
RUN useradd --create-home --uid 1000 mcpo && install -d -o mcpo -g mcpo /home/mcpo/.mcpo
|
|
USER 1000
|
|
|
|
# Expose port (optional but common default)
|
|
EXPOSE 8000
|
|
|
|
# Entrypoint set for easy container invocation
|
|
ENTRYPOINT ["mcpo", "--host", "0.0.0.0"]
|
|
|
|
# Default help CMD (can override at runtime)
|
|
CMD ["--help"] |