Builder Image v3.7.1
Main rule
- build plugins in
bavix/gripmock:<tag>-builder - run GripMock in
bavix/gripmock:<tag> - always keep the same
<tag>
This is required because Go plugins are sensitive to toolchain and platform differences (plugin.Open).
Published images
For each release tag <tag>:
bavix/gripmock:<tag>- runtime, cgo, plugins workbavix/gripmock:<tag>-builder- toolchain for compiling pluginsbavix/gripmock:<tag>-slim- runtime without cgo, no plugin supportbavix/gripmock:<tag>-debian- Debian runtime, cgo, plugins workbavix/gripmock:<tag>-debian-builder- Debian toolchain for compiling pluginsbavix/gripmock:<tag>-debian-slim- Debian runtime without cgo, no plugin supportbavix/gripmock:<tag>-nonroot- Alpine runtime as UID/GID65532:65532bavix/gripmock:<tag>-slim-nonroot- Alpine slim runtime as UID/GID65532:65532bavix/gripmock:<tag>-debian-nonroot- Debian runtime as UID/GID65532:65532bavix/gripmock:<tag>-debian-slim-nonroot- Debian slim runtime as UID/GID65532:65532- append
-legacyfor gzip-compressed variants, for example:<tag>-nonroot-legacy
Same tags are published to ghcr.io/bavix/gripmock.
Pick -slim only if you never pass --plugins; plugin.Open there fails with plugin: not implemented.
Nonroot images run as UID/GID 65532:65532 and can read mounted proto and stub files when that user has read permission. Commands that write files (for example gripmock dump) need a writable output mount accessible to that UID/GID. The tag describes the image's configured user; it does not require a rootless container engine.
CI behavior
.github/workflows/builder.yamlowns the build matrix, credentials, digest artifacts, and release trigger.github/actions/build-image-setbuilds a compatible builder/runtime set and derives nonroot wrappers from the pushed base digests.github/actions/publish-image-manifestgenerates the established version tags and merges per-architecture digestsDockerfile.builderandDockerfile.builder.debianbuild and publish the Alpine and Debian builder imagesDockerfileandDockerfile.debianbuild the corresponding runtime (cgo=1) and slim (cgo=0) imagesDockerfile.nonrootderives nonroot tags from the matching runtime digest; it changes only the configured UID/GID and does not rebuild the binary- runtime builds pass
BUILDER_IMAGE=ghcr.io/bavix/gripmock@<builder digest>from the same pipeline run - Build plugins with the builder image matching the runtime distro.
- nonroot and slim-nonroot tags are published for both zstd and gzip (
-legacy) variants - normal tags use zstd-compressed layers; Docker 23+ or containerd is required to pull them
-legacytags use gzip-compressed layers for older runtimes- only the default Alpine zstd runtime publishes
latest; Debian, builder, slim, and legacy tags do not compete for it
This keeps runtime and builder strictly aligned.
Usage
The builder image ships the runtime sources at /gripmock-src. Point your module at them: plugin.Open matches packages by the path they were compiled from, and /gripmock-src is where the runtime image compiled them too.
docker run --rm \
-v "$PWD":/work \
-w /work \
bavix/gripmock:3.18.4-builder \
sh -c 'go mod edit -replace github.com/bavix/gripmock/v3=/gripmock-src \
&& go mod tidy \
&& go build -buildmode=plugin -o ./plugins/myplugin.so ./cmd/myplugin'Use sh -c, not sh -lc: a login shell resets PATH and go is not on it. Drop the replace afterwards with go mod edit -dropreplace github.com/bavix/gripmock/v3.
docker run --rm \
-p 4770:4770 -p 4771:4771 \
-v "$PWD/plugins":/plugins \
-v "$PWD/proto":/proto \
bavix/gripmock:3.18.4 \
--plugins=/plugins/myplugin.so /proto/service.protoIf plugin does not load
- verify the runtime is not the
-slimimage - verify runtime and builder use the same base tag
- verify the module points at
/gripmock-src(go mod edit -replace ...) - do not pass
-trimpath: the runtime image is built without it, and the flag has to match on both sides - rebuild plugin in matching
:<tag>-builder - verify architecture (
amd64/arm64)