Skip to content

fix: Build the Go feature server image in two stages - #7066

Merged
shuchu merged 1 commit into
feast-dev:masterfrom
NopeCharon:fix/go-feature-server-runtime-image
Oct 25, 2026
Merged

shuchu merged 1 commit into
feast-dev:masterfrom
NopeCharon:fix/go-feature-server-runtime-image

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The go-feature-server image is built and published straight from the full golang:1.26 image. Every tag therefore ships the Go toolchain, gcc, protoc, the module and build caches, and Debian development packages such as linux-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:

  • Builder stage: the existing steps (protoc install, proto generation, go build), unchanged. The base is pinned to golang:1.26-trixie, which is what golang:1.26 resolves to today.
  • Runtime stage: debian:trixie-slim with ca-certificates, plus the compiled feast binary. 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 /app or pass --chdir keep working.

Result (linux/arm64 build):

before (single stage) after
image size ~3.1 GB ~214 MB
linux-libc-dev 6.12.113-1 not installed
Go toolchain / gcc / protoc present absent

ldd ./feast in the runtime image shows only libc.so.6 and the dynamic loader.

Which issue(s) this PR fixes:

Fixes #7060

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Manual tests:

  • Built the image with docker buildx build -f go/infra/docker/feature-server/Dockerfile --load ..
  • Inside the image, checked ldd ./feast, dpkg -s linux-libc-dev (not installed), and that /usr/local/go, gcc and protoc are absent.
  • Ran ./feast --type=http --chdir=<mounted repo> against a repo with a local registry and a SQLite online store:
    • the HTTP and metrics servers start
    • /health returns Healthy
    • /get-online-features reaches the registry lookup and returns the expected "feature view doesn't exist" error for the empty registry

Misc

No Go code changes. make build-go-feature-server-docker and the publish workflow use the same Dockerfile path and arguments, so nothing changes in CI.

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]>
@NopeCharon
NopeCharon requested a review from a team as a code owner October 23, 2026 16:45

@shuchu shuchu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov-commenter

codecov-commenter commented Oct 25, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.97%. Comparing base (e304a84) to head (88e31b7).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            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              
Flag Coverage Δ
go-feature-server 30.37% <ø> (-0.21%) ⬇️
python-unit 52.45% <ø> (ø)
see 1 file with indirect coverage changes

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e304a84...88e31b7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shuchu
shuchu merged commit 1e5e90c into feast-dev:master Oct 25, 2026
28 checks passed
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.

go-feature-server image ships outdated linux-libc-dev with known kernel CVEs (DSA-6238-1/6253-1/6274-1/6295-1)

3 participants