From c90fc9578e81c4f7713acecda029a934f70cf732 Mon Sep 17 00:00:00 2001 From: zhanghongtong Date: Fri, 13 Aug 2021 11:32:05 +0800 Subject: [PATCH] chore(CI): using docker official actions for build packages workflow Signed-off-by: zhanghongtong --- .github/workflows/build_packages.yaml | 63 ++++++++++++++------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index f14063eaf..a96ef705e 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -356,49 +356,50 @@ jobs: path: . - name: unzip source code run: unzip -q source-${{ matrix.otp }}.zip + - name: get version + id: version + working-directory: source + run: echo "::set-output name=version::$(./pkg-vsn.sh)" - uses: docker/setup-buildx-action@v1 - uses: docker/setup-qemu-action@v1 with: image: tonistiigi/binfmt:latest platforms: all - - name: build emqx docker image + - uses: docker/build-push-action@v2 if: github.event_name != 'release' - env: - ERL_OTP: erl${{ matrix.otp }} - PROFILE: ${{ matrix.profile }} - working-directory: source - run: | - PKG_VSN="$(./pkg-vsn.sh)" - docker buildx build --no-cache \ - --platform=linux/amd64,linux/arm64 \ - --build-arg PKG_VSN=$PKG_VSN \ - --build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-alpine \ - --build-arg RUN_FROM=alpine:3.14 \ - --build-arg EMQX_NAME=$PROFILE \ - --tag emqx/$PROFILE:$PKG_VSN \ - -f deploy/docker/Dockerfile . + with: + push: false + pull: true + no-cache: true + platforms: linux/amd64,linux/arm64 + tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }} + build-args: | + PKG_VSN=${{ steps.version.outputs.version }} + BUILD_FROM=emqx/build-env:erl${{ matrix.otp }}-alpine + RUN_FROM=alpine:3.14 + EMQX_NAME=${{ matrix.profile }} + file: source/deploy/docker/Dockerfile + context: source - uses: docker/login-action@v1 if: github.event_name == 'release' with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - - name: build emqx docker image + - uses: docker/build-push-action@v2 if: github.event_name == 'release' - env: - ERL_OTP: erl${{ matrix.otp }} - PROFILE: ${{ matrix.profile }} - working-directory: source - run: | - PKG_VSN="$(./pkg-vsn.sh)" - docker buildx build --no-cache \ - --platform=linux/amd64,linux/arm64 \ - --build-arg PKG_VSN=$PKG_VSN \ - --build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-alpine \ - --build-arg RUN_FROM=alpine:3.14 \ - --build-arg EMQX_NAME=$PROFILE \ - --tag emqx/$PROFILE:$PKG_VSN \ - -f deploy/docker/Dockerfile \ - --push . + with: + push: true + pull: true + no-cache: true + platforms: linux/amd64,linux/arm64 + tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }} + build-args: | + PKG_VSN=${{ steps.version.outputs.version }} + BUILD_FROM=emqx/build-env:erl${{ matrix.otp }}-alpine + RUN_FROM=alpine:3.14 + EMQX_NAME=${{ matrix.profile }} + file: source/deploy/docker/Dockerfile + context: source delete-artifact: