Add Docker image documentation and workflow (#225)

Adds a CI action to build docker images and publish them to GHCR on
every commit. We can then use these when deploying the registry.

This turned out to be an upstream blocker of building the infra for
deployment, and something like this is needed for either deployment
approach we're exploring.

---

## Summary
- Add comprehensive documentation for pre-built Docker images in README
- Include usage examples and configuration guidance  
- Add GitHub Actions workflow for automated Docker image publishing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
adam jones 2025-08-07 16:25:35 +01:00 • committed by GitHub
commit f04c995f0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 65 additions and 0 deletions

47
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Docker Build and Push
on:
push:
branches: [ main ]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix=main-{{date 'YYYYMMDD'}}-,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -417,6 +417,24 @@ The service can be configured using environment variables:
| `MCP_REGISTRY_SEED_IMPORT` | Import `seed.json` on first run | `true` |
| `MCP_REGISTRY_SERVER_ADDRESS` | Listen address for the server | `:8080` |
## Pre-built Docker Images
Pre-built Docker images are automatically published to GitHub Container Registry on each release and main branch commit:
```bash
# Run latest from main branch
docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:latest
# Run specific commit build
docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main-20250806-a1b2c3d
```
**Available image tags:**
- `latest` - Latest commit from main branch
- `main-<date>-<sha>` - Specific commit builds
**Configuration:** The Docker images support all environment variables listed in the [Configuration](#configuration) section. For production deployments, you'll need to configure the database connection and other settings via environment variables.
## License
See the [LICENSE](LICENSE) file for details.