-
-
Notifications
You must be signed in to change notification settings - Fork 72
improve build #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
improve build #420
Conversation
522ecd5 to
0c7104e
Compare
| GOOS=$TARGETOS GOARCH=$TARGETARCH go install \ | ||
| -ldflags="-s -w -X github.com/owenthereal/upterm/internal/version.Version=${VERSION} -X github.com/owenthereal/upterm/internal/version.GitCommit=${GIT_COMMIT} -X github.com/owenthereal/upterm/internal/version.Date=${BUILD_DATE}" \ | ||
| ./cmd/... | ||
| goreleaser build --single-target --auto-snapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: --auto-snapshot automatically sets --snapshot if the repository is dirty, this happens if:
- files are modified
- untracked files are present
Here's what versions look like (docker build -f Dockerfile.uptermd -t uptermd . && docker run --rm uptermd version)
Repo is clean (no modifications, no untracked files):
Uptermd version 0.19.0
Git commit: 522ecd5085d8998d72bfa3f63c04fb53e5cbcd77
Build date: 2025-11-30T13:29:39Z
Repo is dirty (untracked files are present):
Uptermd version 0.19.1-snapshot
Git commit: 522ecd5085d8998d72bfa3f63c04fb53e5cbcd77
Build date: 2025-11-30T13:29:39Z
This simplifies the build process: - no passing around of build args as env vars - `ldflags` are only defined in `.goreleaser.yml` - always use the same method for building binaries
- uptermd binary is now being built as part of the docker build with goreleaser - goreleaser-specific stage has been removed
0c7104e to
9899ca5
Compare
|
Although this makes it easier to build docker images using From the goreleaser docs:
Meaning that we either stop building images using goreleaser and the Would like an opinion from @owenthereal before continuing. |
Thanks for proposing this. Could you share more about the reasons you want to avoid managing custom build arguments? One alternative is that we publish a |
It's mostly about avoiding having to manually pass git information via build args when this information is available in the git repo itself (.git dir) and goreleaser parsing information this information already. |
I noticed that version information had been broken for a while. This was fixed in #411 (thanks!), but I would like to avoid having to manage custom build arguments to accomplish this when
goreleaseris available.This PR does that:
goreleaser.yml: adduptermd-flyruleDockerfile.uptermd: use goreleaser to build binariesThis simplifies the build process:
ldflagsare only defined in.goreleaser.ymlgoreleaser.yml: get rid of docker ids and --target argumentsuptermdbinary is now being built in the docker image withgoreleaser