Docker #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
release: | |
description: "Release (e.g., v1.9.0)" | |
required: true | |
jobs: | |
docker-release: | |
runs-on: ubuntu-latest | |
env: | |
RELEASE: ${{ github.event.inputs.release || github.event.release.tag_name }} | |
IMAGE_PREFIX: ${{ github.repository }} | |
COREDNS_VERSION: 1.11.1 | |
LINUX_ARCH: amd64 arm64 | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout coredns | |
uses: actions/checkout@v4 | |
with: | |
repository: coredns/coredns | |
ref: v${{ env.COREDNS_VERSION }} | |
- name: Build Docker Images | |
run: | | |
sed -i 's/github.com\/coredns\/coredns\/releases\/download/github.com\/delta10\/k8s_cache\/releases\/download/' Makefile.docker | |
make VERSION=${RELEASE:1} DOCKER=delta10 "LINUX_ARCH=$LINUX_ARCH" -f Makefile.docker release | |
- name: Show Docker Images | |
run: docker images | |
- name: Publish Docker Images | |
run: | | |
set -x -e | |
for arch in amd64 arm64; do | |
IMAGE_LIST+=" ghcr.io/delta10/coredns:$arch-${RELEASE:1}" | |
docker tag delta10/coredns:$arch-${RELEASE:1} ghcr.io/delta10/coredns:$arch-${RELEASE:1} | |
docker push ghcr.io/delta10/coredns:$arch-${RELEASE:1} | |
done | |
docker manifest create --amend ghcr.io/delta10/coredns:${RELEASE:1} $IMAGE_LIST | |
docker manifest create --amend ghcr.io/delta10/coredns:latest $IMAGE_LIST | |
docker manifest push --purge ghcr.io/delta10/coredns:${RELEASE:1} | |
docker manifest push --purge ghcr.io/delta10/coredns:latest | |