Repository navigation
feat(cli): Publish the CLI Docker image as getsentry/sentry-cli - #2513
sentry-junior[bot] wants to merge 4 commits into
Conversation
Build a multi-arch (amd64, arm64) image from the standalone Linux binaries on debian:bookworm-slim, push it to ghcr.io/getsentry/toolkit/sentry-cli tagged with the commit, and copy the release commit's image to Docker Hub getsentry/sentry-cli (version and latest) with Craft docker targets. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 MCP Server Token Cost ReportSummary
Per-Tool Breakdown
Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better. MCP Apps viewsEach
The budget applies to raw bytes, and the view's generator fails over it. |
BYK
left a comment
There was a problem hiding this comment.
Debian instead of Alpine, and much larger: roughly 295 MB uncompressed for amd64, against about 13 MB compressed for v3. Most of that is the 128 MB binary.
How small can we go if we try to stick to Alpine and use Musl bulids?
|
Short answer: about half the size. I built a musl version of the binary and measured it in Alpine images (amd64):
The binary is the floor: the musl one is 141 MB raw and ~42 MB gzipped, and Alpine adds only a few MB on top. Most of what we'd save is Debian's base (~28 MB gz) and git's Perl dependency (Alpine's git doesn't need Perl). It only needs The catch is that
This would also give Alpine users a standalone binary. Want me to switch this PR to Alpine + musl (adding the musl targets to the CLI build), or ship Debian now and do musl as a follow-up? |
BYK
left a comment
There was a problem hiding this comment.
Want me to switch this PR to Alpine + musl (adding the musl targets to the CLI build), or ship Debian now and do musl as a follow-up?
Sounds good but before that let's also try a distroless base if we can?
Finally, if you think it makes sense, file an issue to fossilize so we can add musl support? It's my project at the end of the day and we can get a fork under getsentry org for you to work on it
|
I tried distroless. It works with the glibc binary we already build, so the Docker image doesn't need musl. Sizes for amd64:
Details:
The options:
I'd go with 3 if keeping a shell matters, and 1 if it doesn't. Which one? fossilize musl issue: I think it's worth doing even if the image goes distroless, because Alpine users of the installer still get sent to npm. I wrote the issue for BYK/fossilize: add |
BYK
left a comment
There was a problem hiding this comment.
distroless cc-debian12 + copied git (47 MB gz): smallest, and no build changes, but no shell, so the GitLab pattern breaks.
Let's go with this. What's the GitLab pattern tho?
Re fossilize: I forked it to getsentry/fossilize so let's get a patch up there and make an upstream PR?
Switch the base from debian:bookworm-slim to gcr.io/distroless/cc-debian12 and copy in only libatomic, the git binary and its two libraries from a Debian 12 stage. The amd64 image goes from 295 MB to 156 MB uncompressed (95 MB to 46 MB gzipped). git now trusts only the /work mount point. The image has no shell, so the docs replace the GitLab entrypoint example with a COPY --from pattern.
|
Switched to distroless in bcb7d46. Result for amd64: 156 MB uncompressed, 46 MB gzipped. It runs What changed besides the base image:
The GitLab pattern. GitLab's Docker executor runs a job's upload-sourcemaps:
image:
name: getsentry/sentry-cli
entrypoint: [""]
script:
- sentry-cli sourcemaps upload ./distThat needs The docs now drop that example. They tell users to either install the CLI in the job, or copy the binary into their own glibc-based image: COPY --from=getsentry/sentry-cli /usr/local/bin/sentry /usr/local/bin/sentryI checked that the binary runs from Correction to my musl comments above. I said nodejs.org doesn't publish musl Node. That's wrong for x64: official |
Pin debian:bookworm-slim and distroless/cc-debian12 by digest. The smoke test now runs `release propose-version --json` through the entrypoint, so it checks that the CLI finds the git copied into the distroless image and reads the checkout mounted at /work. Co-Authored-By: BYK <[email protected]>
# Conflicts: # .craft.yml # package.json
Part of #1965. Ships the v4 CLI as the
getsentry/sentry-cliDocker image, following getsentry/spotlight: a thin base image with the compiled binary dropped in.What changes
packages/cli/Dockerfile:gcr.io/distroless/cc-debian12with the standalone Linux binary at/usr/local/bin/sentryas the entrypoint,WORKDIR /work, and the update check off, since a container can't upgrade its own image.cli-build.yml: a newbuild-dockerjob takes the Linux binaries frombuild-binaryand pushes a multi-arch (amd64/arm64) image toghcr.io/getsentry/toolkit/sentry-cli, tagged with the commit, then smoke-tests it on both architectures. There's no layer cache, so release images never build from a cache thatmainfilled..craft.yml:dockertargets that copy the release commit's image to Docker Hubgetsentry/sentry-cli, tagged with the version andlatest.The GHCR name is
toolkit/sentry-clibecauseghcr.io/getsentry/toolkitholds the nightly binpatch artifacts, andsentry cli upgradelists that package's tags.Differences from the v3 image
/workworking directory, so mounting the project at/workstill works once commands are renamed.sentryand gets every argument. v3's entrypoint script dropped a leadingsentry-cliargument and ran a shell on request. There's nosentry-clionPATH.--entrypoint shand CI jobs that clear the entrypoint and run a script in the image, such as GitLab CI, no longer work. The docs show copying the binary into your own image withCOPY --from=getsentry/sentry-cliinstead.libatomic.so.1is needed because the binary's Node runtime links it.gitis kept for v3 parity: v3 had libgit2 built in, and v4 runsgitforrelease set-commits --auto,release propose-version, andcode-mappings uploadagainst the mounted checkout. Only thegitbinary and its libraries (libpcre2-8,zlib) are copied, about 6 MB. Local read commands work; remote helpers such asgit-remote-httpsaren't included. Git trusts/work, where the host user's checkout is mounted; a checkout mounted somewhere else and read as root needs--userset to the checkout owner.Release plan
packages/clirelease pushes to Docker Hub and moveslatest, which is 3.8.2 today, so a 0.x release in between would put a 0.x build there.dockertarget has no prerelease check, so a prerelease also moveslatest.Needs a person
ghcr.io/getsentry/toolkit/sentry-clias a private package. getsentry/publish reads it with its ownGITHUB_TOKEN, so before the first release a package admin needs to make it public or give getsentry/publish read access.sentrybuilderfor every repo, and that account pushedgetsentry/sentry-cli:3.8.2. No new grant should be needed. Check that its token isn't limited to particular repos.Docker Hub (latest)target from getsentry/sentry-cli's.craft.yml. Otherwise a 3.x maintenance release moveslatestback.via @BYK.
--
View Session [Sentry]