Compare commits

...

6 Commits

Author SHA1 Message Date
Damien
1af298f74e Remove Prefect PostgreSQL backup worker Docker image
Some checks failed
Build and Push Docker Images / build (push) Failing after 3s
2026-03-21 10:40:58 +01:00
755423cf4e 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
2026-03-15 10:28:04 +00:00
5df64b1d2b Merge pull request 'feat/infrahub-mcp' (#6) from feat/infrahub-mcp into main
Some checks failed
Build and Push Docker Images / build (push) Failing after 27s
Reviewed-on: #6
2026-03-15 10:23:07 +00:00
9a007ddf69 docs: rewrite README in English 2026-03-15 10:06:30 +00:00
b992e57560 docs: add README for infrahub-mcp image 2026-03-15 09:37:58 +00:00
10ed48d24d feat: add infrahub-mcp Dockerfile
Packages the OpsMill infrahub-mcp-server into a Docker container
running fastmcp in SSE mode on port 8001.
2026-03-15 09:37:46 +00:00
4 changed files with 89 additions and 73 deletions

View File

@@ -0,0 +1,37 @@
FROM python:3.13-slim
# System dependencies for uv and potential wheel builds
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Clone the upstream MCP server repository
# Use INFRAHUB_MCP_VERSION to pin a specific tag/branch at build time
# When left empty, the repo's default branch is used
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
# Install Python dependencies via uv
RUN uv sync --frozen --no-dev
# Default environment variables
# INFRAHUB_API_TOKEN should be passed at runtime (not baked into the image)
ENV INFRAHUB_ADDRESS=http://localhost:8000
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8001
EXPOSE 8001
# Run the MCP server in SSE mode (network-accessible)
ENTRYPOINT ["uv", "run", "fastmcp", "run", "src/infrahub_mcp/server.py:mcp", "--transport", "sse"]

View File

@@ -0,0 +1,52 @@
# infrahub-mcp
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,
running in SSE mode on port 8001.
## Environment variables
| Variable | Description | Default |
|----------------------|----------------------------------|--------------------------|
| `INFRAHUB_ADDRESS` | Infrahub instance URL | `http://localhost:8000` |
| `INFRAHUB_API_TOKEN` | Infrahub API token | *(required at runtime)* |
| `MCP_HOST` | Listen address | `0.0.0.0` |
| `MCP_PORT` | Listen port | `8001` |
## Build
```bash
docker build -t gitea.arnodo.fr/damien/infrahub-mcp:latest images/infrahub-mcp/
```
### Pin a specific upstream version
```bash
docker build --build-arg INFRAHUB_MCP_VERSION=v1.0.0 \
-t gitea.arnodo.fr/damien/infrahub-mcp:v1.0.0 images/infrahub-mcp/
```
## Usage
```bash
docker run -d --name infrahub-mcp \
-e INFRAHUB_ADDRESS=http://infrahub.local:8000 \
-e INFRAHUB_API_TOKEN=my-api-token \
-p 8001:8001 \
gitea.arnodo.fr/damien/infrahub-mcp:latest
```
## MCP client configuration (Claude Desktop, Cursor, etc.)
Point your client to the container's SSE endpoint:
```json
{
"mcpServers": {
"infrahub_mcp": {
"url": "http://localhost:8001/sse"
}
}
}
```

View File

@@ -1,35 +0,0 @@
# =============================================================================
# Prefect Worker - PostgreSQL Backup
#
# Image Docker pour un worker Prefect dédié aux sauvegardes PostgreSQL
# Inclut les outils nécessaires pour dump PG et upload vers S3 (Garage)
# =============================================================================
FROM prefecthq/prefect:3-python3.12
LABEL maintainer="Damien Arnodo"
LABEL org.opencontainers.image.title="Prefect Worker - PostgreSQL Backup"
LABEL org.opencontainers.image.description="Prefect worker with PostgreSQL and S3 tools for database backups"
# Installation des outils système
# - postgresql-client : pg_dump, pg_restore, psql
# - git : nécessaire pour cloner les repositories contenant le code des flows
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-client \
git \
&& rm -rf /var/lib/apt/lists/*
# Installation des dépendances Python pour S3 et PostgreSQL
RUN pip install --no-cache-dir \
boto3 \
psycopg2-binary \
prefect-aws
# Création d'un utilisateur non-root
RUN useradd -m -u 1000 prefect
USER prefect
WORKDIR /app
# Le worker sera démarré via la commande dans docker-compose
# CMD ["prefect", "worker", "start", "--pool", "my-pool"]

View File

@@ -1,38 +0,0 @@
# Prefect Worker - PostgreSQL Backup
Image Docker pour un worker Prefect dédié aux sauvegardes de bases de données PostgreSQL vers un stockage S3-compatible (Garage).
## Contenu
- **Base** : `prefecthq/prefect:3-python3.12`
- **Outils PostgreSQL** : `pg_dump`, `pg_restore`, `psql`
- **Python** : `boto3`, `psycopg2-binary`
## Utilisation
### Dans docker-compose
```yaml
prefect-worker:
image: gitea.arnodo.fr/damien/prefect-worker-pg-backup:latest
environment:
- PREFECT_API_URL=http://prefect-server:4200/api
command: prefect worker start --pool pg-backup-pool --type process
depends_on:
- prefect-server
```
### Variables d'environnement requises pour les flows
| Variable | Description |
|----------|-------------|
| `PREFECT_API_URL` | URL de l'API Prefect |
| `AWS_ACCESS_KEY_ID` | Clé d'accès S3 (Garage) |
| `AWS_SECRET_ACCESS_KEY` | Secret S3 (Garage) |
| `AWS_ENDPOINT_URL` | Endpoint S3 (ex: `https://s3.garage.example.com`) |
## Build local
```bash
docker build -t prefect-worker-pg-backup:latest images/prefect-worker-pg-backup/
```