Skip to content

Commit 43baf01

Browse files
adamtheturtleclaude
andcommitted
Use docker/bake-action to share base layer across images
Replace the matrix strategy with docker/bake-action, which builds all three targets (vws, vwq, target-manager) in a single invocation. This allows the shared base stage to be built once instead of three times, improving build performance on multi-platform releases. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 1778e87 commit 43baf01

2 files changed

Lines changed: 44 additions & 19 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,10 @@ jobs:
135135
verbose: true
136136

137137
docker:
138-
name: Publish Docker image (${{ matrix.image.target }})
138+
name: Publish Docker images
139139
needs: release
140140
runs-on: ubuntu-latest
141141

142-
strategy:
143-
matrix:
144-
image:
145-
- target: target-manager
146-
repo: adamtheturtle/vuforia-target-manager-mock
147-
- target: vws
148-
repo: adamtheturtle/vuforia-vws-mock
149-
- target: vwq
150-
repo: adamtheturtle/vuforia-vwq-mock
151-
152142
permissions: {}
153143

154144
steps:
@@ -169,13 +159,9 @@ jobs:
169159
- name: Set up QEMU
170160
uses: docker/setup-qemu-action@v3
171161

172-
- name: Build and push Docker image
173-
uses: docker/build-push-action@v6.19.2
162+
- name: Build and push Docker images
163+
uses: docker/bake-action@v6.10.0
174164
with:
175-
file: src/mock_vws/_flask_server/Dockerfile
176-
platforms: linux/amd64,linux/arm64
177165
push: true
178-
target: ${{ matrix.image.target }}
179-
tags: |-
180-
${{ matrix.image.repo }}:latest
181-
${{ matrix.image.repo }}:${{ needs.release.outputs.version }}
166+
env:
167+
VERSION: ${{ needs.release.outputs.version }}

docker-bake.hcl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
variable "VERSION" {
2+
default = "latest"
3+
}
4+
5+
group "default" {
6+
targets = ["vws", "vwq", "target-manager"]
7+
}
8+
9+
target "_base" {
10+
dockerfile = "src/mock_vws/_flask_server/Dockerfile"
11+
platforms = ["linux/amd64", "linux/arm64"]
12+
}
13+
14+
target "vws" {
15+
inherits = ["_base"]
16+
target = "vws"
17+
tags = [
18+
"adamtheturtle/vuforia-vws-mock:latest",
19+
"adamtheturtle/vuforia-vws-mock:${VERSION}",
20+
]
21+
}
22+
23+
target "vwq" {
24+
inherits = ["_base"]
25+
target = "vwq"
26+
tags = [
27+
"adamtheturtle/vuforia-vwq-mock:latest",
28+
"adamtheturtle/vuforia-vwq-mock:${VERSION}",
29+
]
30+
}
31+
32+
target "target-manager" {
33+
inherits = ["_base"]
34+
target = "target-manager"
35+
tags = [
36+
"adamtheturtle/vuforia-target-manager-mock:latest",
37+
"adamtheturtle/vuforia-target-manager-mock:${VERSION}",
38+
]
39+
}

0 commit comments

Comments
 (0)