Skip to content

fix(docker): add libzstd-dev for static validator link + lean image as default build target#43

Merged
ErenAri merged 1 commit into
mainfrom
fix/dockerfile-zstd-default-target
Jun 24, 2026
Merged

fix(docker): add libzstd-dev for static validator link + lean image as default build target#43
ErenAri merged 1 commit into
mainfrom
fix/dockerfile-zstd-default-target

Conversation

@ErenAri

@ErenAri ErenAri commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What

Two Dockerfile bugs broke the containerized install path, both fixed here.

1. docker build --target with-validator failed: cannot find -lzstd

The validator-builder stage statically links the in-guest validator (-lbpf -lelf -lzstd -lz), but libzstd-dev was missing from its apt packages. Static libbpf/libelf pull in zstd, so the link failed:

/usr/bin/ld: cannot find -lzstd: No such file or directory

Added libzstd-dev to the builder.

2. Plain docker build . built the wrong (fat) image

with-validator was the last stage, so a no---target build resolved to the fat validator+clang+llvm image — contradicting the documented docker build -t bpfcompat:dev . → lean binary-only image. Reordered so the lean final stage is last and is the real default.

Verification

  • docker build . → lean image builds, runs bpfcompat version
  • docker build --target with-validator → builds, runs bpfcompat version, and bundles a working bpfcompat-validator at /usr/libexec/bpfcompat/
  • go build ./..., go vet ./..., go test ./... all green (no Go changes)

🤖 Generated with Claude Code

…age the default build target

Two Dockerfile bugs broke the containerized install:

1. The validator-builder stage statically links the validator
   (-lbpf -lelf -lzstd -lz) but libzstd-dev was missing from its apt
   packages, so `docker build --target with-validator` failed with
   `/usr/bin/ld: cannot find -lzstd`. Static libbpf/libelf pull in zstd.

2. with-validator was the last stage, so a plain `docker build .` built
   the fat validator+clang+llvm image instead of the documented lean,
   binary-only image. Reordered so the lean `final` stage is last and is
   the real default target.

Verified: `docker build .` and `docker build --target with-validator`
both build and run `bpfcompat version`; the validator image carries a
working bpfcompat-validator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ErenAri ErenAri merged commit f594d23 into main Jun 24, 2026
6 checks passed
@ErenAri ErenAri deleted the fix/dockerfile-zstd-default-target branch June 24, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant