Skip to content

Commit 075f603

Browse files
committed
build and push Docker Desktop module image on release
Add workflow to build and push docker/compose-desktop-module image to Docker Hub on version tag push, used by Docker Desktop's update system to deliver the Compose CLI plugin. Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
1 parent ae92bef commit 075f603

4 files changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/merge.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,44 @@ jobs:
110110
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
111111
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
112112
113+
module-image-prepare:
114+
if: startsWith(github.ref, 'refs/tags/v')
115+
runs-on: ubuntu-24.04
116+
outputs:
117+
repo-slug: docker/compose-desktop-module
118+
steps:
119+
# FIXME: can't use env object in reusable workflow inputs: https://github.com/orgs/community/discussions/26671
120+
- run: echo "Exposing env vars for reusable workflow"
121+
122+
module-image:
123+
if: startsWith(github.ref, 'refs/tags/v')
124+
uses: docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
125+
needs:
126+
- module-image-prepare
127+
permissions:
128+
contents: read # same as global permission
129+
id-token: write # for signing attestation(s) with GitHub OIDC Token
130+
with:
131+
runner: amd64
132+
target: image-module-cross
133+
cache: true
134+
cache-scope: module-image
135+
output: image
136+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
137+
sbom: true
138+
provenance: true
139+
set-meta-labels: true
140+
meta-images: |
141+
${{ needs.module-image-prepare.outputs.repo-slug }}
142+
meta-tags: |
143+
type=ref,event=tag
144+
meta-bake-target: meta-helper
145+
secrets:
146+
registry-auths: |
147+
- registry: docker.io
148+
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
149+
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
150+
113151
desktop-edge-test:
114152
runs-on: ubuntu-latest
115153
needs: bin-image

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,16 @@ RUN --mount=from=binary \
195195

196196
FROM scratch AS release
197197
COPY --from=releaser /out/ /
198+
199+
FROM --platform=$BUILDPLATFORM alpine AS module-releaser
200+
WORKDIR /work
201+
ARG TARGETOS
202+
RUN --mount=from=binary \
203+
mkdir -p /cli-plugins/compose/$TARGETOS && \
204+
cp docker-compose* "/cli-plugins/compose/$TARGETOS/docker-compose$(ls docker-compose* | sed -e 's/^docker-compose//')"
205+
206+
FROM scratch AS module
207+
ARG TARGETOS
208+
COPY --from=module-releaser /cli-plugins/compose/$TARGETOS /cli-plugins/compose/$TARGETOS
209+
COPY ./desktop-module/module-metadata.json /
210+
COPY LICENSE /
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": 1,
3+
"content": [
4+
{
5+
"type": "cli-plugin",
6+
"name": "compose"
7+
}
8+
]
9+
}

docker-bake.hcl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,17 @@ target "image-cross" {
146146
inherits = ["meta-helper", "binary-cross"]
147147
output = ["type=image"]
148148
}
149+
150+
target "image-module-cross" {
151+
inherits = ["meta-helper", "binary-cross"]
152+
target = "module"
153+
output = ["type=image"]
154+
platforms = [
155+
"darwin/amd64",
156+
"darwin/arm64",
157+
"linux/amd64",
158+
"linux/arm64",
159+
"windows/amd64",
160+
"windows/arm64",
161+
]
162+
}

0 commit comments

Comments
 (0)