1
- name : Create and publish a Docker image
1
+ name : Create and publish multi-platform Docker images
2
2
permissions :
3
3
contents : read # Needed to check out the repository
4
4
packages : write # Needed to push images to GitHub Container Registry (ghcr.io)
10
10
- " v*.*.*"
11
11
12
12
jobs :
13
- build-image :
14
- name : Build Image
13
+ build-and-push :
14
+ name : Create Multi-Platform Container Images
15
15
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
71
16
permissions :
72
17
contents : read
73
18
packages : write
78
23
- name : Checkout
79
24
uses : actions/checkout@v4
80
25
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
+
81
36
- name : Set up Docker Buildx
82
37
uses : docker/setup-buildx-action@v3
83
38
113
68
org.opencontainers.image.authors=Keikoproj Contributors
114
69
org.opencontainers.image.title=Instance Manager
115
70
116
- - name : Create manifest list and push
71
+ - name : Build and push multi-arch image
117
72
id : push
118
73
uses : docker/build-push-action@v6
119
74
with :
@@ -124,9 +79,23 @@ jobs:
124
79
provenance : false
125
80
tags : ${{ steps.metadata.outputs.tags }}
126
81
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
127
95
build-args : |
128
96
CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
129
97
VERSION=${{ github.ref_name }}
98
+ REVISION=${{ github.sha }}
130
99
outputs : |
131
100
type=image,name=docker.io/${{ github.repository_owner }}/instance-manager,push=true
132
101
type=image,name=ghcr.io/${{ github.repository_owner }}/instance-manager,push=true
0 commit comments