Docker #421
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: | |
workflow_dispatch: | |
schedule: | |
# Build the job every day for the master branch | |
- cron: '0 0 * * *' | |
push: | |
branches: [ "main", 'v*.*.*' ] | |
tags: [ 'v*.*.*' ] | |
pull_request: | |
branches: [ "main", 'v*.*.*' ] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: quay.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: powercloud/kind-node | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["master"] | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Set variables | |
run: | | |
KIND_VERSION=$(cat KIND_VERSION) | |
BASE_IMAGE=$(cat BASE_IMAGE) | |
echo "KIND_VERSION=$KIND_VERSION" >> $GITHUB_ENV | |
echo "BASE_IMAGE=$BASE_IMAGE" >> $GITHUB_ENV | |
- name: Install kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Build kind image | |
run: | | |
mkdir -p tmp/kubernetes | |
git clone --single-branch --branch ${{ matrix.version }} https://github.com/kubernetes/kubernetes tmp/kubernetes | |
kind build node-image $PWD/tmp/kubernetes --arch ppc64le --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }} --base-image ${{ env.BASE_IMAGE }} | |
- name: Publish image | |
if: github.event_name != 'pull_request' | |
run: | | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }} |