Repository navigation
fix: Build the Go feature server image in two stages - #7066
Merged
shuchu merged 1 commit intoOct 25, 2026
Merged
Conversation
The go-feature-server image was built and shipped from the full golang:1.26 image, so every published tag carried the Go toolchain, gcc, protoc, the module and build caches, and Debian development packages such as linux-libc-dev. Those packages are flagged by container scanners (for example DSA-6238-1, DSA-6253-1, DSA-6274-1 and DSA-6295-1 against linux-libc-dev), and users cannot remediate them because they come from the base layer. Keep the existing build steps in a builder stage and copy only the compiled binary into a debian:trixie-slim runtime stage with ca-certificates. The builder is pinned to golang:1.26-trixie, which is what golang:1.26 resolves to today, so the cgo-linked binary (needed by go-sqlite3) runs against the same glibc release. The working directory, binary path, exposed port and default command are unchanged, so existing deployments that mount a feature repo under /app or pass --chdir keep working. The runtime image no longer contains linux-libc-dev, the Go toolchain or compilers, and drops from about 3.1 GB to about 214 MB. Fixes feast-dev#7060 Signed-off-by: NopeCharon <[email protected]>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7066 +/- ##
==========================================
- Coverage 50.99% 50.97% -0.02%
==========================================
Files 455 455
Lines 56994 56994
Branches 8321 8321
==========================================
- Hits 29063 29055 -8
- Misses 25946 25954 +8
Partials 1985 1985
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
The
go-feature-serverimage is built and published straight from the fullgolang:1.26image. Every tag therefore ships the Go toolchain, gcc, protoc, the module and build caches, and Debian development packages such aslinux-libc-dev. Scanners flag that package for DSA-6238-1, DSA-6253-1, DSA-6274-1 and DSA-6295-1. Users can't remediate it because it comes from the base layer.This PR turns the Dockerfile into a two-stage build:
go build), unchanged. The base is pinned togolang:1.26-trixie, which is whatgolang:1.26resolves to today.debian:trixie-slimwithca-certificates, plus the compiledfeastbinary. The binary is cgo-linked (go-sqlite3), so the runtime uses the same Debian release as the builder to get a matching glibc.These stay the same: the working directory
/app, the binary path./feast, the exposed port and the default command. Existing deployments that mount the feature repo under/appor pass--chdirkeep working.Result (linux/arm64 build):
linux-libc-dev6.12.113-1ldd ./feastin the runtime image shows onlylibc.so.6and the dynamic loader.Which issue(s) this PR fixes:
Fixes #7060
Checks
git commit -s)Testing Strategy
Manual tests:
docker buildx build -f go/infra/docker/feature-server/Dockerfile --load ..ldd ./feast,dpkg -s linux-libc-dev(not installed), and that/usr/local/go,gccandprotocare absent../feast --type=http --chdir=<mounted repo>against a repo with a local registry and a SQLite online store:/healthreturnsHealthy/get-online-featuresreaches the registry lookup and returns the expected "feature view doesn't exist" error for the empty registryMisc
No Go code changes.
make build-go-feature-server-dockerand the publish workflow use the same Dockerfile path and arguments, so nothing changes in CI.