review: harden the Docker image + align GHCR action versions
Address PR #1648 review: - Bump the GHCR action majors to match current v1 (docker/login-action v4, docker/metadata-action v6, docker/setup-buildx-action v4, actions/attest-build-provenance v4) to avoid Dependabot churn. - Make the image tags explicit (`type=semver` + `flavor: latest=true`) instead of relying on `flavor.latest=auto`, so a release lands both the version tags and `:latest` — the README's bare `ghcr.io/…/inspector` URL won't 404. - Run the container as the non-root `node` user with /home/node as workdir (its writable home is where the inspector stores the catalog / OAuth state). - Add a HEALTHCHECK that probes `/` via Node's global fetch (no curl in slim). - Trim specification/ and docs/ from the build context. (test-servers/ stays — `tsc -b` typechecks the integration tests that import its alias, so excluding it breaks the build.) Re-verified locally: `docker build` succeeds, the container runs as uid 1000 (node), serves `/` (200), and the HEALTHCHECK reports healthy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
This commit is contained in:
parent
941bf13587
commit
f5e095e8f0
1 changed files with 29 additions and 4 deletions
11
Dockerfile
11
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"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue