Publish Docker images to GHCR.io and Quay.io (#14372)
* Also publish official images to GHCR. This provides an alternative source for users to get our Docker images. * Add basic static labels to our Docker images. These provide slightly better behavior on GHCR, as well as providing useful metadata for users. * Also publish to Quay.io. * Fix typo. Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud> --------- Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Austin S. Hemmelgarn committed
Jan 31, 2023 at 08:18 UTC
3dec478c804e554bfb136acb78af2fd0ba54f6d0
2 files changed
+40
-5
.github/workflows/docker.yml
+32
-5
@@ -169,12 +169,28 @@ jobs:
169
id: buildx
170
uses: docker/setup-buildx-action@v2
171
- name: Docker Hub Login
172
- id: login
172
+ id: docker-hub-login
173
if: github.repository == 'netdata/netdata'
174
uses: docker/login-action@v2
175
with:
176
username: ${{ secrets.DOCKER_HUB_USERNAME }}
177
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
178
+ - name: GitHub Container Registry Login
179
+ id: ghcr-login
180
+ if: github.repository == 'netdata/netdata'
181
+ uses: docker/login-action@v2
182
+ with:
183
+ registry: ghcr.io
184
+ username: ${{ github.repository_owner }}
185
+ password: ${{ secrets.GITHUB_TOKEN }}
186
+ - name: Quay.io Login
187
+ id: quay-login
188
+ if: github.repository == 'netdata/netdata'
189
+ uses: docker/login-action@v2
190
+ with:
191
+ registry: quay.io
192
+ username: ${{ secrets.NETDATABOT_QUAY_USERNAME }}
193
+ password: ${{ secrets.NETDATABOT_QUAY_TOKEN }}
194
- name: Docker Build
195
id: build
196
uses: docker/build-push-action@v3
@@ -199,7 +215,9 @@ jobs:
215
Setup environment: ${{ steps.env.outcome }}
216
Setup QEMU: ${{ steps.qemu.outcome }}
217
Setup buildx: ${{ steps.buildx.outcome }}
202
- Authenticate against DockerHub: ${{ steps.login.outcome }}
218
+ Login to DockerHub: ${{ steps.docker-hub-login.outcome }}
219
+ Login to GHCR: ${{ steps.ghcr-login.outcome }}
220
+ Login to Quay: ${{ steps.quay-login.outcome }}
221
Build and publish images: ${{ steps.build.outcome }}
222
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
223
if: >-
@@ -254,12 +272,20 @@ jobs:
272
id: buildx
273
uses: docker/setup-buildx-action@v2
274
- name: Docker Hub Login
257
- id: login
275
+ id: docker-hub-login
276
if: github.repository == 'netdata/netdata'
277
uses: docker/login-action@v2
278
with:
279
username: ${{ secrets.DOCKER_HUB_USERNAME }}
280
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
281
+ - name: GitHub Container Registry Login
282
+ id: ghcr-login
283
+ if: github.repository == 'netdata/netdata'
284
+ uses: docker/login-action@v2
285
+ with:
286
+ registry: ghcr.io
287
+ username: ${{ github.repository_owner }}
288
+ password: ${{ secrets.GITHUB_TOKEN }}
289
- name: Docker Build
290
id: build
291
uses: docker/build-push-action@v3
@@ -280,13 +306,14 @@ jobs:
306
SLACK_USERNAME: 'GitHub Actions'
307
SLACK_MESSAGE: |-
308
${{ github.repository }}: Failed to build or publish Docker debug images.
283
- CHeckout: ${{ steps.checkout.outcome }}
309
+ Checkout: ${{ steps.checkout.outcome }}
310
Generate release tags: ${{ steps.release-tags.outcome }}
311
Generate nightly tags: ${{ steps.nightly-tags.outcome }}
312
Setup environment: ${{ steps.env.outcome }}
313
Setup QEMU: ${{ steps.qemu.outcome }}
314
Setup buildx: ${{ steps.buildx.outcome }}
289
- Authenticate against DockerHub: ${{ steps.login.outcome }}
315
+ Login to DockerHub: ${{ steps.docker-hub-login.outcome }}
316
+ Login to GHCR: ${{ steps.ghcr-login.outcome }}
317
Build and publish images: ${{ steps.build.outcome }}
318
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
319
if: >-
packaging/docker/Dockerfile
+8
@@ -119,3 +119,11 @@ ENTRYPOINT ["/usr/sbin/run.sh"]
119
HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD /usr/sbin/health.sh
120
121
ONBUILD ENV NETDATA_OFFICIAL_IMAGE=false
122
+
123
+LABEL org.opencontainers.image.authors="Netdatabot <bot@netdata.cloud>"
124
+LABEL org.opencontainers.image.url="https://netdata.cloud"
125
+LABEL org.opencontainers.image.documentation="https://learn.netdata.cloud"
126
+LABEL org.opencontainers.image.source="https://github.com/netdata/netdata"
127
+LABEL org.opencontainers.image.title="Netdata Agent"
128
+LABEL org.opencontainers.image.description="Official Netdata Agent Docker Image"
129
+LABEL org.opencontainers.image.vendor="Netdata Inc."