|
| 1 | +name: Build docker images |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: test-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + prepare: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + otp: ${{ steps.otp.outputs.version }} |
| 15 | + elixir: ${{ steps.elixir.outputs.version }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - name: get otp_version |
| 19 | + id: otp |
| 20 | + run: | |
| 21 | + otp_version=$(grep -E "^\+\sOTP-.*" ./RELEASE.md | sed 's/\+\sOTP-//g' | jq -R -s -c 'split("\n")[:-1]') |
| 22 | + echo "version=$otp_version" >> $GITHUB_OUTPUT |
| 23 | + - name: get elixir_version |
| 24 | + id: elixir |
| 25 | + run: | |
| 26 | + elixir_version=$(grep -E "^\+\sElixir-.*" ./RELEASE.md | sed 's/\+\sElixir-//g' | jq -R -s -c 'split("\n")[:-1]') |
| 27 | + echo "version=$elixir_version" >> $GITHUB_OUTPUT |
| 28 | +
|
| 29 | + build: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: |
| 32 | + - prepare |
| 33 | + |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + emqx_minor: |
| 37 | + - "5.0" |
| 38 | + otp: ${{ fromJSON(needs.prepare.outputs.otp) }} |
| 39 | + elixir: ${{ fromJSON(needs.prepare.outputs.elixir) }} |
| 40 | + platform: |
| 41 | + - [ubuntu20.04 , "linux/amd64,linux/arm64"] |
| 42 | + - [ubuntu18.04 , "linux/amd64,linux/arm64"] |
| 43 | + - [ubuntu16.04 , "linux/amd64,linux/arm64"] |
| 44 | + - [debian11 , "linux/amd64,linux/arm64"] |
| 45 | + - [debian10 , "linux/amd64,linux/arm64"] |
| 46 | + - [debian9 , "linux/amd64,linux/arm64"] |
| 47 | + - [el8 , "linux/amd64,linux/arm64"] |
| 48 | + - [el7 , "linux/amd64,linux/arm64"] |
| 49 | + - [amzn2 , "linux/amd64,linux/arm64"] |
| 50 | + - [raspbian10 , "linux/arm64"] |
| 51 | + - [raspbian9 , "linux/arm64"] |
| 52 | + - [alpine3.15.1, "linux/amd64,linux/arm64"] |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v3 |
| 56 | + - uses: docker/setup-buildx-action@v2 |
| 57 | + - uses: docker/setup-qemu-action@v2 |
| 58 | + - uses: docker/login-action@v2 |
| 59 | + with: |
| 60 | + registry: ghcr.io |
| 61 | + username: ${{ github.actor }} |
| 62 | + password: ${{ github.token }} |
| 63 | + - uses: docker/build-push-action@v3 |
| 64 | + with: |
| 65 | + push: false |
| 66 | + pull: true |
| 67 | + platforms: ${{ matrix.platform[1] }} |
| 68 | + build-args: | |
| 69 | + BUILD_FROM=ghcr.io/${{ github.repository }}/base-${{ matrix.emqx_minor }}:${{ matrix.platform[0] }} |
| 70 | + OTP_VERSION=${{ matrix.otp }} |
| 71 | + ELIXIR_VERSION=${{ matrix.elixir }} |
| 72 | + file: ./Dockerfile |
| 73 | + context: . |
0 commit comments