Update docker base image #1104
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: Update docker base image | |
permissions: | |
contents: write | |
packages: write | |
## Update the base image every day | |
on: | |
workflow_dispatch: | |
schedule: | |
## In UTC | |
- cron: '0 0 * * *' | |
## Build base images to be used by other github workflows | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.repository == 'lf-edge/ekuiper' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- debian | |
- alpine | |
golang: | |
- 1.23.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/.docker-buildx-cache | |
key: docker-buildx-${{ matrix.golang }}-${{ matrix.os }} | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- uses: docker/build-push-action@v6 | |
if: matrix.os == 'debian' | |
with: | |
push: true | |
pull: true | |
cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max | |
cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
build-args: GO_VERSION=${{ matrix.golang }} | |
tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} | |
file: .github/dockerfile/Dockerfile.${{ matrix.os }} | |
- uses: docker/build-push-action@v6 | |
if: matrix.os == 'alpine' | |
with: | |
push: true | |
pull: true | |
cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max | |
cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
build-args: GO_VERSION=${{ matrix.golang }} | |
tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }} | |
file: .github/dockerfile/Dockerfile.${{ matrix.os }} | |
- name: Update cache | |
run: | | |
rm -rf /tmp/.docker-buildx-cache | |
mv /tmp/.docker-buildx-cache-new /tmp/.docker-buildx-cache |