chore(CI): using docker official actions for build packages workflow

Signed-off-by: zhanghongtong <rory-z@outlook.com>
This commit is contained in:
zhanghongtong 2021-08-13 11:32:05 +08:00 committed by Rory Z
parent 3f1d3b9cf4
commit c90fc9578e
1 changed files with 32 additions and 31 deletions

View File

@ -356,49 +356,50 @@ jobs:
path: . path: .
- name: unzip source code - name: unzip source code
run: unzip -q source-${{ matrix.otp }}.zip 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-buildx-action@v1
- uses: docker/setup-qemu-action@v1 - uses: docker/setup-qemu-action@v1
with: with:
image: tonistiigi/binfmt:latest image: tonistiigi/binfmt:latest
platforms: all platforms: all
- name: build emqx docker image - uses: docker/build-push-action@v2
if: github.event_name != 'release' if: github.event_name != 'release'
env: with:
ERL_OTP: erl${{ matrix.otp }} push: false
PROFILE: ${{ matrix.profile }} pull: true
working-directory: source no-cache: true
run: | platforms: linux/amd64,linux/arm64
PKG_VSN="$(./pkg-vsn.sh)" tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }}
docker buildx build --no-cache \ build-args: |
--platform=linux/amd64,linux/arm64 \ PKG_VSN=${{ steps.version.outputs.version }}
--build-arg PKG_VSN=$PKG_VSN \ BUILD_FROM=emqx/build-env:erl${{ matrix.otp }}-alpine
--build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-alpine \ RUN_FROM=alpine:3.14
--build-arg RUN_FROM=alpine:3.14 \ EMQX_NAME=${{ matrix.profile }}
--build-arg EMQX_NAME=$PROFILE \ file: source/deploy/docker/Dockerfile
--tag emqx/$PROFILE:$PKG_VSN \ context: source
-f deploy/docker/Dockerfile .
- uses: docker/login-action@v1 - uses: docker/login-action@v1
if: github.event_name == 'release' if: github.event_name == 'release'
with: with:
username: ${{ secrets.DOCKER_HUB_USER }} username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: build emqx docker image - uses: docker/build-push-action@v2
if: github.event_name == 'release' if: github.event_name == 'release'
env: with:
ERL_OTP: erl${{ matrix.otp }} push: true
PROFILE: ${{ matrix.profile }} pull: true
working-directory: source no-cache: true
run: | platforms: linux/amd64,linux/arm64
PKG_VSN="$(./pkg-vsn.sh)" tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }}
docker buildx build --no-cache \ build-args: |
--platform=linux/amd64,linux/arm64 \ PKG_VSN=${{ steps.version.outputs.version }}
--build-arg PKG_VSN=$PKG_VSN \ BUILD_FROM=emqx/build-env:erl${{ matrix.otp }}-alpine
--build-arg BUILD_FROM=emqx/build-env:$ERL_OTP-alpine \ RUN_FROM=alpine:3.14
--build-arg RUN_FROM=alpine:3.14 \ EMQX_NAME=${{ matrix.profile }}
--build-arg EMQX_NAME=$PROFILE \ file: source/deploy/docker/Dockerfile
--tag emqx/$PROFILE:$PKG_VSN \ context: source
-f deploy/docker/Dockerfile \
--push .
delete-artifact: delete-artifact: