Skip to content

Commit 6fdc399

Browse files
committed
fix: implement proper multi-arch image annotations following GitHub docs
Signed-off-by: Todd Ekenstam <[email protected]>
1 parent 152452d commit 6fdc399

File tree

2 files changed

+30
-59
lines changed

2 files changed

+30
-59
lines changed

.github/workflows/image-push.yml

+28-59
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create and publish a Docker image
1+
name: Create and publish multi-platform Docker images
22
permissions:
33
contents: read # Needed to check out the repository
44
packages: write # Needed to push images to GitHub Container Registry (ghcr.io)
@@ -10,64 +10,9 @@ on:
1010
- "v*.*.*"
1111

1212
jobs:
13-
build-image:
14-
name: Build Image
13+
build-and-push:
14+
name: Create Multi-Platform Container Images
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
platform: [linux/amd64, linux/arm64, linux/arm/v7]
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v4
22-
23-
- name: Set up QEMU
24-
uses: docker/setup-qemu-action@v3
25-
26-
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v3
28-
29-
- name: Docker metadata
30-
id: metadata
31-
uses: docker/metadata-action@v5
32-
with:
33-
images: docker.io/${{ github.repository_owner }}/instance-manager,ghcr.io/${{ github.repository_owner }}/instance-manager
34-
tags: |
35-
type=ref,event=branch
36-
type=ref,event=pr
37-
type=semver,pattern={{version}}
38-
type=semver,pattern={{major}}.{{minor}}
39-
labels: |
40-
org.opencontainers.image.description=A Kubernetes controller for creating and managing worker node instance groups across multiple providers
41-
org.opencontainers.image.licenses=Apache-2.0
42-
org.opencontainers.image.source=https://github.com/keikoproj/instance-manager
43-
org.opencontainers.image.url=https://github.com/keikoproj/instance-manager/blob/master/README.md
44-
org.opencontainers.image.vendor=keikoproj
45-
org.opencontainers.image.authors=Keikoproj Contributors
46-
org.opencontainers.image.created=${{ github.event.repository.updated_at }}
47-
org.opencontainers.image.version=${{ github.ref_name }}
48-
org.opencontainers.image.revision=${{ github.sha }}
49-
org.opencontainers.image.title=Instance Manager
50-
51-
- name: Build for ${{ matrix.platform }}
52-
uses: docker/build-push-action@v6
53-
with:
54-
context: .
55-
file: ./Dockerfile
56-
platforms: ${{ matrix.platform }}
57-
push: false
58-
tags: ${{ steps.metadata.outputs.tags }}
59-
labels: ${{ steps.metadata.outputs.labels }}
60-
outputs: type=image,name=docker.io/${{ github.repository_owner }}/instance-manager,push-by-digest=true,name-canonical=true,push=false
61-
cache-from: type=gha
62-
cache-to: type=gha,mode=max
63-
build-args: |
64-
CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
65-
VERSION=${{ github.ref_name }}
66-
67-
merge-and-push:
68-
name: Merge and Push
69-
runs-on: ubuntu-latest
70-
needs: build-image
7116
permissions:
7217
contents: read
7318
packages: write
@@ -78,6 +23,16 @@ jobs:
7823
- name: Checkout
7924
uses: actions/checkout@v4
8025

26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version-file: go.mod
30+
cache: true
31+
cache-dependency-path: go.sum
32+
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@v3
35+
8136
- name: Set up Docker Buildx
8237
uses: docker/setup-buildx-action@v3
8338

@@ -113,7 +68,7 @@ jobs:
11368
org.opencontainers.image.authors=Keikoproj Contributors
11469
org.opencontainers.image.title=Instance Manager
11570
116-
- name: Create manifest list and push
71+
- name: Build and push multi-arch image
11772
id: push
11873
uses: docker/build-push-action@v6
11974
with:
@@ -124,9 +79,23 @@ jobs:
12479
provenance: false
12580
tags: ${{ steps.metadata.outputs.tags }}
12681
labels: ${{ steps.metadata.outputs.labels }}
82+
cache-from: type=gha
83+
cache-to: type=gha,mode=max
84+
annotations: |
85+
org.opencontainers.image.description=A Kubernetes controller for creating and managing worker node instance groups across multiple providers
86+
org.opencontainers.image.licenses=Apache-2.0
87+
org.opencontainers.image.source=https://github.com/keikoproj/instance-manager
88+
org.opencontainers.image.url=https://github.com/keikoproj/instance-manager/blob/master/README.md
89+
org.opencontainers.image.vendor=keikoproj
90+
org.opencontainers.image.authors=Keikoproj Contributors
91+
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
92+
org.opencontainers.image.version=${{ github.ref_name }}
93+
org.opencontainers.image.revision=${{ github.sha }}
94+
org.opencontainers.image.title=Instance Manager
12795
build-args: |
12896
CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
12997
VERSION=${{ github.ref_name }}
98+
REVISION=${{ github.sha }}
13099
outputs: |
131100
type=image,name=docker.io/${{ github.repository_owner }}/instance-manager,push=true
132101
type=image,name=ghcr.io/${{ github.repository_owner }}/instance-manager,push=true

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ FROM gcr.io/distroless/static:latest
2424
# Add ARG declarations to receive build args
2525
ARG CREATED
2626
ARG VERSION
27+
ARG REVISION
2728

2829
WORKDIR /
2930
COPY --from=builder /workspace/manager .
3031
ENTRYPOINT ["/manager"]
3132
LABEL org.opencontainers.image.source="https://github.com/keikoproj/instance-manager"
3233
LABEL org.opencontainers.image.version="${VERSION}"
3334
LABEL org.opencontainers.image.created="${CREATED}"
35+
LABEL org.opencontainers.image.revision="${REVISION}"
3436
LABEL org.opencontainers.image.licenses="Apache-2.0"
3537
LABEL org.opencontainers.image.url="https://github.com/keikoproj/instance-manager/blob/master/README.md"
3638
LABEL org.opencontainers.image.description="A Kubernetes controller for creating and managing worker node instance groups across multiple providers"

0 commit comments

Comments
 (0)