diff --git a/.dockerignore b/.dockerignore index df1dad5e..5f7a290f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,6 +18,12 @@ test-servers/build storybook-static coverage +# Docs/specs aren't referenced by the build — trim them from the context. +# (test-servers/ stays: `tsc -b` typechecks the integration tests that import +# the `@modelcontextprotocol/inspector-test-server` alias.) +specification +docs + # Packed tarballs (the image makes its own) *.tgz diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2e4fbf0c..fbdd32a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,7 +166,7 @@ jobs: uses: actions/checkout@v6 - name: Log in to the Container registry - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -174,15 +174,23 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6 with: images: ghcr.io/${{ github.repository }} + # Be explicit rather than relying on `flavor.latest=auto`: on a release + # cut both the version tags and `latest` land, so the README's bare + # `ghcr.io/…/inspector` (implicit `:latest`) never 404s. + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + flavor: | + latest=true - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Build and push Docker image id: push @@ -195,7 +203,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} - name: Generate artifact attestation - uses: actions/attest-build-provenance@v3 + uses: actions/attest-build-provenance@v4 with: subject-name: ghcr.io/${{ github.repository }} subject-digest: ${{ steps.push.outputs.digest }} diff --git a/Dockerfile b/Dockerfile index 07fddb10..c41c415e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,17 @@ ENV HOST=0.0.0.0 \ MCP_AUTO_OPEN_ENABLED=false EXPOSE 6274 +# Run as the non-root `node` user the base image ships. Its home (/home/node) is +# where the inspector writes runtime state (the default catalog, OAuth token +# storage), so use it as the working directory. +USER node +WORKDIR /home/node + +# Report readiness by probing the served SPA (`/` needs no auth). Uses Node's +# global fetch — no curl/wget in the slim image. +HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ + CMD node -e "fetch('http://127.0.0.1:'+(process.env.CLIENT_PORT||6274)+'/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))" + # Default to the web UI; override the args to run --cli / --tui. ENTRYPOINT ["mcp-inspector"] CMD ["--web"]