fix: correct infrahub-mcp Dockerfile and README (#7)
All checks were successful
Build and Push Docker Images / build (push) Successful in 56s

## What changed

Fixes the build failure caused by wrong upstream repo URL and missing default branch.

### Dockerfile
- **Repo URL**: `opsmill/infrahub-mcp` (was `opsmill/infrahub-mcp-server`)
- **Default branch**: clone without `--branch` when `INFRAHUB_MCP_VERSION` is unset, so the upstream default branch is used automatically
- **Secrets warning**: removed `ENV INFRAHUB_API_TOKEN=""` — the token should be passed at runtime via `-e`, not baked into the image
- **Comments**: rewritten in English

### README
- Fixed upstream repo link
- Clarified that `INFRAHUB_API_TOKEN` is required at runtime

Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
2026-03-15 10:28:04 +00:00
parent 5df64b1d2b
commit 755423cf4e
2 changed files with 21 additions and 14 deletions

View File

@@ -1,30 +1,37 @@
FROM python:3.13-slim FROM python:3.13-slim
# pendances système pour uv et build éventuel de wheels # System dependencies for uv and potential wheel builds
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates curl && \ apt-get install -y --no-install-recommends git ca-certificates curl && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Installer uv # Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Cloner le repo MCP server upstream # Clone the upstream MCP server repository
ARG INFRAHUB_MCP_VERSION=main # Use INFRAHUB_MCP_VERSION to pin a specific tag/branch at build time
RUN git clone --depth 1 --branch ${INFRAHUB_MCP_VERSION} \ # When left empty, the repo's default branch is used
https://github.com/opsmill/infrahub-mcp-server.git /app ARG INFRAHUB_MCP_VERSION=""
RUN if [ -n "${INFRAHUB_MCP_VERSION}" ]; then \
git clone --depth 1 --branch "${INFRAHUB_MCP_VERSION}" \
https://github.com/opsmill/infrahub-mcp.git /app; \
else \
git clone --depth 1 \
https://github.com/opsmill/infrahub-mcp.git /app; \
fi
WORKDIR /app WORKDIR /app
# Installer les dépendances Python via uv # Install Python dependencies via uv
RUN uv sync --frozen --no-dev RUN uv sync --frozen --no-dev
# Variables d'environnement par défaut # Default environment variables
# INFRAHUB_API_TOKEN should be passed at runtime (not baked into the image)
ENV INFRAHUB_ADDRESS=http://localhost:8000 ENV INFRAHUB_ADDRESS=http://localhost:8000
ENV INFRAHUB_API_TOKEN=""
ENV MCP_HOST=0.0.0.0 ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8001 ENV MCP_PORT=8001
EXPOSE 8001 EXPOSE 8001
# Lancer le serveur MCP en mode SSE (accessible via réseau) # Run the MCP server in SSE mode (network-accessible)
ENTRYPOINT ["uv", "run", "fastmcp", "run", "src/infrahub_mcp/server.py:mcp", "--transport", "sse"] ENTRYPOINT ["uv", "run", "fastmcp", "run", "src/infrahub_mcp/server.py:mcp", "--transport", "sse"]

View File

@@ -1,16 +1,16 @@
# infrahub-mcp # infrahub-mcp
Docker image for the Infrahub MCP server ([OpsMill](https://github.com/opsmill/infrahub-mcp-server)). Docker image for the Infrahub MCP server ([OpsMill](https://github.com/opsmill/infrahub-mcp)).
Packages the infrahub-mcp-server into a ready-to-use container, Packages the infrahub-mcp server into a ready-to-use container,
running the server in SSE mode on port 8001. running in SSE mode on port 8001.
## Environment variables ## Environment variables
| Variable | Description | Default | | Variable | Description | Default |
|----------------------|----------------------------------|--------------------------| |----------------------|----------------------------------|--------------------------|
| `INFRAHUB_ADDRESS` | Infrahub instance URL | `http://localhost:8000` | | `INFRAHUB_ADDRESS` | Infrahub instance URL | `http://localhost:8000` |
| `INFRAHUB_API_TOKEN` | Infrahub API token | (empty) | | `INFRAHUB_API_TOKEN` | Infrahub API token | *(required at runtime)* |
| `MCP_HOST` | Listen address | `0.0.0.0` | | `MCP_HOST` | Listen address | `0.0.0.0` |
| `MCP_PORT` | Listen port | `8001` | | `MCP_PORT` | Listen port | `8001` |