Skip to content

Update docker base image #535

Update docker base image

Update docker base image #535

Workflow file for this run

name: Update docker base image
concurrency:
group: base-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
base_image_vsn:
required: true
type: string
default: "5.0"
ref:
required: false
type: string
## Build base images to be used by other github workflows
jobs:
base:
name: ${{ matrix.platform }} ${{ matrix.arch }}
runs-on: ${{ github.repository_owner == 'emqx' && format('aws-ubuntu22.04-{0}', matrix.arch) || (matrix.arch == 'arm64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04') }}
strategy:
fail-fast: false
matrix:
base_image_vsn:
- ${{ github.event.inputs.base_image_vsn }}
arch:
- amd64
- arm64
platform:
- ubuntu24.04
- ubuntu22.04
- ubuntu20.04
- ubuntu18.04
- debian13
- debian12
- debian11
- el9
- el8
- el7
- amzn2
- amzn2023
- alpine3.15.1
- alpine3.21.3
env:
PLATFORM: ${{ matrix.platform }}
ARCH: ${{ matrix.arch }}
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ github.event.inputs.ref }}
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: define base tag
id: base_tag
run: |
echo "tag=${PLATFORM}-${ARCH}" | tee -a $GITHUB_OUTPUT
- name: Get cache
run: aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }} /tmp/.docker-buildx-cache
- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: base_meta
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: type=raw,value=${{ steps.base_tag.outputs.tag }}
- name: Build base image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
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/${{ matrix.arch }}"
tags: ${{ steps.base_meta.outputs.tags }}
labels: ${{ steps.base_meta.outputs.labels }}
file: ${{ matrix.platform }}/Dockerfile
context: .
- name: Update cache
run: aws s3 sync --delete /tmp/.docker-buildx-cache-new s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }}