Skip to content

refactor: change image versioning #50

refactor: change image versioning

refactor: change image versioning #50

Workflow file for this run

name: Build docker images
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
otp: ${{ steps.otp.outputs.version }}
elixir: ${{ steps.elixir.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: get otp_version
id: otp
run: |
otp_version=$(grep -E "^\+\sOTP-.*" ./RELEASE.md | sed 's/\+\sOTP-//g' | jq -R -s -c 'split("\n")[:-1]')
echo "version=$otp_version" >> $GITHUB_OUTPUT
- name: get elixir_version
id: elixir
run: |
elixir_version=$(grep -E "^\+\sElixir-.*" ./RELEASE.md | sed 's/\+\sElixir-//g' | jq -R -s -c 'split("\n")[:-1]')
echo "version=$elixir_version" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
matrix:
base_image_vsn:
- "5.0"
otp: ${{ fromJSON(needs.prepare.outputs.otp) }}
elixir: ${{ fromJSON(needs.prepare.outputs.elixir) }}
platform:
- [ubuntu22.04 , "linux/amd64,linux/arm64"]
- [ubuntu20.04 , "linux/amd64,linux/arm64"]
- [ubuntu18.04 , "linux/amd64,linux/arm64"]
- [ubuntu16.04 , "linux/amd64,linux/arm64"]
- [debian12 , "linux/amd64,linux/arm64"]
- [debian11 , "linux/amd64,linux/arm64"]
- [debian10 , "linux/amd64,linux/arm64"]
- [debian9 , "linux/amd64,linux/arm64"]
- [el9 , "linux/amd64,linux/arm64"]
- [el8 , "linux/amd64,linux/arm64"]
- [el7 , "linux/amd64,linux/arm64"]
- [amzn2 , "linux/amd64,linux/arm64"]
- [amzn2023 , "linux/amd64,linux/arm64"]
- [alpine3.15.1, "linux/amd64,linux/arm64"]
services:
registry:
image: registry:2
ports:
- 5000:5000
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: Get cache
run: aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ matrix.platform[0] }} /tmp/.docker-buildx-cache
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build base image
uses: docker/build-push-action@v3
with:
push: true
platforms: ${{ matrix.platform[1] }}
tags: localhost:5000/${{ github.repository }}/base-${{ matrix.base_image_vsn }}:${{ matrix.platform[0] }}
file: ${{ matrix.platform[0] }}/Dockerfile
context: .
- uses: docker/build-push-action@v3
with:
platforms: ${{ matrix.platform[1] }}
build-args: |
BUILD_FROM=localhost:5000/${{ github.repository }}/base-${{ matrix.base_image_vsn }}:${{ matrix.platform[0] }}
OTP_VERSION=${{ matrix.otp }}
ELIXIR_VERSION=${{ matrix.elixir }}
file: ./Dockerfile
context: .