# syntax=docker/dockerfile:1.7
ARG UBI=python-312-minimal
FROM registry.access.redhat.com/ubi9/${UBI} AS builder
ARG PYTHON_VERSION=3.12
ARG VERSION
ENV APP_HOME=/app
# Transport type: 'http', 'stdio', 'grpc', 'unix' (default: http)
ENV PLUGINS_TRANSPORT=http
# Set to 'true' to install gRPC dependencies (required for grpc/unix transports)
ARG INSTALL_GRPC=false
USER 0
# Image pre-requisites
RUN INSTALL_PKGS="git make gcc gcc-c++ python${PYTHON_VERSION}-devel" && \
microdnf -y --setopt=tsflags=nodocs --setopt=install_weak_deps=0 install $INSTALL_PKGS && \
microdnf -y clean all --enablerepo='*'
# Setup alias from HOME to APP_HOME
RUN mkdir -p ${APP_HOME} && \
chown -R 1001:0 ${APP_HOME} && \
ln -s ${HOME} ${APP_HOME} && \
mkdir -p ${HOME}/resources/config && \
chown -R 1001:0 ${HOME}/resources/config
USER 1001
# Install plugin package
COPY . .
# Install base package, optionally with gRPC extras
RUN pip install --no-cache-dir uv && \
if [ "${INSTALL_GRPC}" = "true" ]; then \
echo "Installing with gRPC support..." && \
python -m uv pip install ".[grpc]"; \
else \
echo "Installing without gRPC support..." && \
python -m uv pip install .; \
fi
# Make default cache directory writable
RUN mkdir -p -m 0776 ${HOME}/.cache
# Update labels
LABEL maintainer="Context Forge MCP Gateway Team" \
name="mcp/mcppluginserver" \
version="${VERSION}" \
url="https://github.com/IBM/mcp-context-forge" \
description="MCP Plugin Server for the Context Forge MCP Gateway"
# App entrypoint
ENTRYPOINT ["sh", "-c", "${HOME}/run-server.sh"]