Skip to content

build: fix static linking in distroless dockerfile#261

Merged
mccutchen merged 4 commits into
mccutchen:mainfrom
ajithcnambiar:chore-build-updates
Jun 9, 2026
Merged

build: fix static linking in distroless dockerfile#261
mccutchen merged 4 commits into
mccutchen:mainfrom
ajithcnambiar:chore-build-updates

Conversation

@ajithcnambiar

Copy link
Copy Markdown
Contributor

Summary

  • Pin Docker build image to golang:1.26.4 (was golang:1.26) for the latest stable Go.
  • Fix Makefile build target: drop the stray ; after CGO_ENABLED=0. The semicolon made it a non-exported shell var, so go build defaulted to CGO enabled and produced a dynamically-linked binary — which fails on distroless with exec /bin/go-httpbin: no such file or directory. Now statically linked.

@ajithcnambiar

Copy link
Copy Markdown
Contributor Author

@matheusfm could you please take a look, thanks! 🙏

@mccutchen mccutchen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yikes, thank you for the fix!

I've neglected this Dockerfile since #244, which uses Dockerfile.release via goreleaser. I need to figure out how to unify the two, this is a good reminder.

Comment thread Dockerfile Outdated
@@ -1,5 +1,5 @@
# syntax = docker/dockerfile:1.3
FROM golang:1.26 AS build
FROM golang:1.26.4 AS build

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm a little conflicted about this — it pins to the latest stable release today but will quickly become a pin to an outdated stable release.

The choice of 1.26 was intentional, making it possible to track the latest stable release as it changes over time. There are definitely tradeoffs, though, as the current approach might require explicitly running docker pull golang:1.26 to make sure you're actually building on the latest stable release.

My inclination would be to drop this change, in part so that I don't have to keep updating it myself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, Ok - if you want me remove Dockerfile change and want to merge just Makefile, open to do that, thanks!

@mccutchen mccutchen changed the title chore build update and fix build: fix static linking in distroless dockerfile Jun 9, 2026
@mccutchen mccutchen enabled auto-merge (squash) June 9, 2026 03:48
@mccutchen mccutchen merged commit 536f214 into mccutchen:main Jun 9, 2026
5 checks passed
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.81%. Comparing base (4778828) to head (e410490).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #261      +/-   ##
==========================================
- Coverage   94.96%   94.81%   -0.15%     
==========================================
  Files           9        9              
  Lines        2027     2027              
==========================================
- Hits         1925     1922       -3     
- Misses         59       62       +3     
  Partials       43       43              

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants