Skip to content

Commit 506dff5

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 506dff5

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

.github/workflows/merge.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,32 @@ jobs:
110110
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
111111
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
112112
113+
module-image:
114+
uses: docker/github-builder/.github/workflows/bake.yml@70313223e2665c3211b454b3fea6534624e78d64 # v1.4.0
115+
permissions:
116+
contents: read # same as global permission
117+
id-token: write # for signing attestation(s) with GitHub OIDC Token
118+
with:
119+
runner: amd64
120+
target: image-module-cross
121+
cache: true
122+
cache-scope: module-image
123+
output: image
124+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
125+
sbom: true
126+
provenance: true
127+
set-meta-labels: true
128+
meta-images: |
129+
docker/compose-desktop-module
130+
meta-tags: |
131+
type=ref,event=tag
132+
meta-bake-target: meta-helper
133+
secrets:
134+
registry-auths: |
135+
- registry: docker.io
136+
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
137+
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
138+
113139
desktop-edge-test:
114140
runs-on: ubuntu-latest
115141
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)