mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 08:36:13 +00:00
fix(docker): inject version/commit/date via build args (closes #422)
The Docker build excluded .git via .dockerignore, so Go's debug.ReadBuildInfo() found no vcs.revision / vcs.time settings and the binaries reported version=dev, commit=unknown, date=unknown in the web UI. Two fixes: 1. Dockerfile — declare ARG VERSION/COMMIT/DATE (default to dev/unknown/unknown so local docker build still works) and pass them to both go build commands via -X main.version/commit/date ldflags. Also add the -trimpath and -s -w flags that the Makefile's BUILDFLAGS already uses but the Dockerfile was missing. 2. release.yml — add a 'Set build date' step, then pass build-args with VERSION, COMMIT (full SHA), and DATE to both docker/build-push-action steps. The .git exclusion in .dockerignore stays correct; version info is now supplied explicitly instead of being read from VCS at build time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
58a5adde5e
commit
6c993f47a8
@@ -523,6 +523,10 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Set build date
|
||||
id: build_date
|
||||
run: echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
||||
|
||||
@@ -552,6 +556,10 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta-service.outputs.tags }}
|
||||
labels: ${{ steps.meta-service.outputs.labels }}
|
||||
build-args: |
|
||||
VERSION=v${{ needs.validate.outputs.version }}
|
||||
COMMIT=${{ github.sha }}
|
||||
DATE=${{ steps.build_date.outputs.date }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@@ -574,6 +582,10 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta-web.outputs.tags }}
|
||||
labels: ${{ steps.meta-web.outputs.labels }}
|
||||
build-args: |
|
||||
VERSION=v${{ needs.validate.outputs.version }}
|
||||
COMMIT=${{ github.sha }}
|
||||
DATE=${{ steps.build_date.outputs.date }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
Reference in New Issue
Block a user