Skip to content

Update docker base image #520

Update docker base image

Update docker base image #520

Workflow file for this run

name: Update docker base image
concurrency:
group: base-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
## Build base images to be used by other github workflows
jobs:
base:
runs-on: ${{ github.repository_owner == 'emqx' && matrix.platform[2] || '["ubuntu-latest"]' }}
strategy:
fail-fast: false
matrix:
base_image_vsn:
- "5.0"
platform:
- [ubuntu22.04fdb, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [ubuntu22.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [ubuntu22.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [ubuntu20.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [ubuntu20.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [ubuntu18.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [ubuntu18.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [ubuntu16.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [ubuntu16.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [debian12, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [debian12, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [debian11, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [debian11, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [debian10, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [debian10, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [debian9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [debian9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [el9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [el9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [el8, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [el8, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [el7, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [el7, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [amzn2, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [amzn2, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [amzn2023, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [amzn2023, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
- [alpine3.15.1, linux/amd64, [self-hosted, linux, x64, ephemeral]]
- [alpine3.15.1, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v2
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: |
PLATFORM=${{ matrix.platform[1] }}
ARCH=${PLATFORM#linux/}
echo "tag=${{ matrix.platform[0] }}-${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@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/metadata-action@v5
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@v5
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: ${{ matrix.platform[1] }}
tags: ${{ steps.base_meta.outputs.tags }}
labels: ${{ steps.base_meta.outputs.labels }}
file: ${{ matrix.platform[0] }}/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 }}