diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..e476860 --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 diff --git a/README.md b/README.md index 50d6426..3bf08ab 100644 --- a/README.md +++ b/README.md @@ -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--` - 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.