11name : Docker image
22
3- # Builds and publishes the public Buzz relay image as ghcr.io/block/buzz.
3+ # Builds and publishes the public Buzz relay images as ghcr.io/block/buzz.
4+ # Normal tags contain stripped binaries; matching debug-* tags contain the same
5+ # optimized binaries with line-table debug information for native profilers.
46#
57# Strategy: each architecture builds on its native runner (ubuntu-24.04 for
68# amd64, ubuntu-24.04-arm for arm64), pushes to GHCR by digest, then a final
@@ -15,8 +17,10 @@ name: Docker image
1517#
1618# Triggers:
1719# - push to main → :main + :sha-<7>
20+ # + :debug-main + :debug-sha-<7>
1821# - push tags relay-v*.*.* → :{version} + :{major}.{minor} + :{major}
19- # (+ :latest for stable, NOT for prereleases)
22+ # + matching :debug-* tags
23+ # (+ :latest/:debug-latest for stable releases)
2024# - pull_request → build only (no push), cache stays warm
2125# - workflow_dispatch → manual relay-tag rescue at the tag itself
2226#
9599 runner : ubuntu-24.04-arm
96100 arch : arm64
97101
98- outputs :
99- # Used downstream by `merge` to stitch the manifest.
100- version : ${{ steps.meta.outputs.version }}
101-
102102 steps :
103103 - name : Checkout
104104 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
@@ -163,12 +163,13 @@ jobs:
163163 org.opencontainers.image.description=WebSocket relay server for the Buzz communications platform
164164 org.opencontainers.image.licenses=Apache-2.0
165165
166- - name : Build and push by digest
167- id : build
166+ - name : Build and push release image by digest
167+ id : build-release
168168 uses : docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
169169 with :
170170 context : .
171171 file : ./Dockerfile
172+ target : runtime
172173 platforms : ${{ matrix.platform }}
173174 labels : ${{ steps.meta.outputs.labels }}
174175 # Push by digest, not by tag — the merge job assembles the tags
@@ -180,25 +181,49 @@ jobs:
180181 cache-to : |
181182 ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && format('type=registry,ref={0}-buildcache:{1},mode=max,compression=zstd', env.IMAGE_NAME, matrix.arch) || '' }}
182183
183- - name : Export digest
184+ - name : Build and push debug image by digest
185+ id : build-debug
186+ uses : docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
187+ with :
188+ context : .
189+ file : ./Dockerfile
190+ target : runtime-debug
191+ platforms : ${{ matrix.platform }}
192+ labels : ${{ steps.meta.outputs.labels }}
193+ outputs : type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
194+ cache-from : |
195+ type=registry,ref=${{ env.IMAGE_NAME }}-buildcache:${{ matrix.arch }}
196+
197+ - name : Export release and debug digests
184198 if : github.event_name != 'pull_request'
185199 env :
186- DIGEST : ${{ steps.build.outputs.digest }}
200+ RELEASE_DIGEST : ${{ steps.build-release.outputs.digest }}
201+ DEBUG_DIGEST : ${{ steps.build-debug.outputs.digest }}
187202 run : |
188- mkdir -p /tmp/digests
189- touch "/tmp/digests/${DIGEST#sha256:}"
203+ mkdir -p /tmp/digests-release /tmp/digests-debug
204+ touch "/tmp/digests-release/${RELEASE_DIGEST#sha256:}"
205+ touch "/tmp/digests-debug/${DEBUG_DIGEST#sha256:}"
190206
191- - name : Upload digest
207+ - name : Upload release digest
192208 if : github.event_name != 'pull_request'
193209 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
194210 with :
195- name : digests-${{ matrix.arch }}
196- path : /tmp/digests/*
211+ name : digests-release-${{ matrix.arch }}
212+ path : /tmp/digests-release/*
213+ if-no-files-found : error
214+ retention-days : 1
215+
216+ - name : Upload debug digest
217+ if : github.event_name != 'pull_request'
218+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
219+ with :
220+ name : digests-debug-${{ matrix.arch }}
221+ path : /tmp/digests-debug/*
197222 if-no-files-found : error
198223 retention-days : 1
199224
200225 merge :
201- name : Merge multi-arch manifest
226+ name : Merge ${{ matrix.variant }} multi-arch manifest
202227 if : github.event_name != 'pull_request'
203228 runs-on : ubuntu-24.04
204229 needs : build
@@ -208,13 +233,21 @@ jobs:
208233 packages : write # push the merged manifest
209234 id-token : write # OIDC for provenance attestation on the manifest
210235 attestations : write
236+ strategy :
237+ fail-fast : false
238+ matrix :
239+ include :
240+ - variant : release
241+ tag_prefix : " "
242+ - variant : debug
243+ tag_prefix : debug-
211244
212245 steps :
213246 - name : Download all per-arch digests
214247 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
215248 with :
216249 path : /tmp/digests
217- pattern : digests-*
250+ pattern : digests-${{ matrix.variant }}- *
218251 merge-multiple : true
219252
220253 - name : Set up Docker Buildx
@@ -237,9 +270,12 @@ jobs:
237270 # the build job's `meta` step for why match=^relay-v(.*)$, why
238271 # value=${{ inputs.version }} carries the rescue-dispatch version,
239272 # and why :latest is left to flavor.latest=auto.
273+ flavor : |
274+ latest=auto
275+ prefix=${{ matrix.tag_prefix }},onlatest=true
240276 tags : |
241277 type=ref,event=branch,enable=${{ github.event_name != 'workflow_dispatch' || inputs.version == '' }}
242- type=sha,prefix=sha-,format=short,enable=${{ github.event_name != 'workflow_dispatch' || inputs.version == '' }}
278+ type=sha,prefix=${{ matrix.tag_prefix }} sha-,format=short,enable=${{ github.event_name != 'workflow_dispatch' || inputs.version == '' }}
243279 type=semver,pattern={{version}},match=^relay-v(.*)$,value=${{ inputs.version }}
244280 type=semver,pattern={{major}}.{{minor}},match=^relay-v(.*)$,value=${{ inputs.version }}
245281 type=semver,pattern={{major}},match=^relay-v(.*)$,value=${{ inputs.version }}
@@ -284,11 +320,12 @@ jobs:
284320 - name : Summary
285321 env :
286322 IMAGE_NAME : ${{ env.IMAGE_NAME }}
323+ VARIANT : ${{ matrix.variant }}
287324 MERGED_DIGEST : ${{ steps.manifest.outputs.digest }}
288325 META_TAGS : ${{ steps.meta.outputs.tags }}
289326 run : |
290327 {
291- echo "### Published \`${IMAGE_NAME}\`"
328+ echo "### Published \`${IMAGE_NAME}\` (${VARIANT}) "
292329 echo
293330 echo "**Digest:** \`${MERGED_DIGEST}\`"
294331 echo
0 commit comments