ci(build_packages): update docker build
Signed-off-by: zhanghongtong <rory-z@outlook.com>
This commit is contained in:
parent
90a2ebfb02
commit
1627ef78e7
|
@ -338,17 +338,6 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
|
||||||
arch:
|
|
||||||
- [amd64, x86_64]
|
|
||||||
- [arm64v8, aarch64]
|
|
||||||
- [arm32v7, arm]
|
|
||||||
- [i386, i386]
|
|
||||||
- [s390x, s390x]
|
|
||||||
exclude:
|
|
||||||
- profile: emqx-ee
|
|
||||||
arch: [i386, i386]
|
|
||||||
- profile: emqx-ee
|
|
||||||
arch: [s390x, s390x]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
|
@ -357,22 +346,56 @@ jobs:
|
||||||
path: .
|
path: .
|
||||||
- name: unzip source code
|
- name: unzip source code
|
||||||
run: unzip -q source.zip
|
run: unzip -q source.zip
|
||||||
- name: build emqx docker image
|
- uses: docker/setup-buildx-action@v1
|
||||||
env:
|
- uses: docker/setup-qemu-action@v1
|
||||||
PROFILE: ${{ matrix.profile }}
|
|
||||||
ARCH: ${{ matrix.arch[0] }}
|
|
||||||
QEMU_ARCH: ${{ matrix.arch[1] }}
|
|
||||||
run: |
|
|
||||||
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
||||||
|
|
||||||
cd source
|
|
||||||
sudo TARGET=emqx/$PROFILE ARCH=$ARCH QEMU_ARCH=$QEMU_ARCH make docker
|
|
||||||
cd _packages/$PROFILE && for var in $(ls ${PROFILE}-docker-* ); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.profile }}
|
image: tonistiigi/binfmt:latest
|
||||||
path: source/_packages/${{ matrix.profile }}/.
|
platforms: all
|
||||||
|
- uses: docker/metadata-action@v3
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: ${{ github.repository_owner }}/${{ matrix.profile }}
|
||||||
|
flavor: |
|
||||||
|
latest=${{ !github.event.release.prerelease }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=match,pattern=[v|e](.*),group=1
|
||||||
|
labels:
|
||||||
|
org.opencontainers.image.otp.version=${{ matrix.otp }}
|
||||||
|
- uses: docker/login-action@v1
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
- uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
|
||||||
|
pull: true
|
||||||
|
no-cache: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-3-alpine
|
||||||
|
RUN_FROM=alpine:3.12
|
||||||
|
EMQX_NAME=${{ matrix.profile }}
|
||||||
|
file: source/deploy/docker/Dockerfile
|
||||||
|
context: source
|
||||||
|
- uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
|
||||||
|
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: Push image to aws ecr
|
||||||
|
if: github.event_name == 'release' && !github.event.release.prerelease && matrix.profile == 'emqx'
|
||||||
|
run: |
|
||||||
|
version=${GITHUB_REF##*/}
|
||||||
|
docker pull emqx/emqx:${version#v}
|
||||||
|
docker tag emqx/emqx:${version#v} public.ecr.aws/emqx/emqx:${version#v}
|
||||||
|
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
|
||||||
|
docker push public.ecr.aws/emqx/emqx:${version#v}
|
||||||
|
|
||||||
delete-artifact:
|
delete-artifact:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
@ -452,15 +475,6 @@ jobs:
|
||||||
-X POST \
|
-X POST \
|
||||||
-d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \
|
-d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \
|
||||||
${{ secrets.EMQX_IO_RELEASE_API }}
|
${{ secrets.EMQX_IO_RELEASE_API }}
|
||||||
- name: push docker image to docker hub
|
|
||||||
if: github.event_name == 'release' && matrix.profile == 'emqx'
|
|
||||||
run: |
|
|
||||||
set -e -x -u
|
|
||||||
sudo make docker-prepare
|
|
||||||
cd _packages/${{ matrix.profile }} && for var in $(ls |grep docker |grep -v sha256); do unzip $var; sudo docker load < ${var%.*}; rm -f ${var%.*}; done && cd -
|
|
||||||
echo ${{ secrets.DOCKER_HUB_TOKEN }} |sudo docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
|
|
||||||
sudo TARGET=emqx/${{ matrix.profile }} make docker-push
|
|
||||||
sudo TARGET=emqx/${{ matrix.profile }} make docker-manifest-list
|
|
||||||
- name: push docker image to aws ecr
|
- name: push docker image to aws ecr
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -36,18 +36,20 @@ jobs:
|
||||||
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
|
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
|
||||||
make deps-emqx-ee
|
make deps-emqx-ee
|
||||||
make clean
|
make clean
|
||||||
fi
|
make emqx-ee-docker
|
||||||
make docker
|
|
||||||
echo "::set-output name=version::$(./pkg-vsn.sh)"
|
|
||||||
if [ -f EMQX_ENTERPRISE ]; then
|
|
||||||
echo "::set-output name=imgname::emqx-ee"
|
echo "::set-output name=imgname::emqx-ee"
|
||||||
|
echo "::set-output name=version::$(./pkg-vsn.sh)"
|
||||||
|
docker save emqx/emqx-ee:$(./pkg-vsn.sh) -o emqx.tar
|
||||||
else
|
else
|
||||||
|
make emqx-docker
|
||||||
echo "::set-output name=imgname::emqx"
|
echo "::set-output name=imgname::emqx"
|
||||||
|
echo "::set-output name=version::$(./pkg-vsn.sh)"
|
||||||
|
docker save emqx/emqx:$(./pkg-vsn.sh) -o emqx.tar
|
||||||
fi
|
fi
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: emqx-docker-image-zip
|
name: emqx-docker-image
|
||||||
path: _packages/${{ steps.build_docker.outputs.imgname }}/${{ steps.build_docker.outputs.imgname }}-docker-${{ steps.build_docker.outputs.version }}.zip
|
path: emqx.tar
|
||||||
|
|
||||||
webhook:
|
webhook:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -63,15 +65,10 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: emqx-docker-image-zip
|
name: emqx-docker-image
|
||||||
path: /tmp
|
path: /tmp
|
||||||
- name: load docker image
|
- name: load docker image
|
||||||
env:
|
run: docker load < /tmp/emqx.tar
|
||||||
imgname: ${{ needs.build.outputs.imgname}}
|
|
||||||
version: ${{ needs.build.outputs.version }}
|
|
||||||
run: |
|
|
||||||
unzip -q /tmp/${imgname}-docker-${version}.zip -d /tmp
|
|
||||||
docker load < /tmp/${imgname}-docker-${version}
|
|
||||||
- name: docker compose up
|
- name: docker compose up
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
env:
|
env:
|
||||||
|
@ -166,15 +163,10 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: emqx-docker-image-zip
|
name: emqx-docker-image
|
||||||
path: /tmp
|
path: /tmp
|
||||||
- name: load docker image
|
- name: load docker image
|
||||||
env:
|
run: docker load < /tmp/emqx.tar
|
||||||
imgname: ${{ needs.build.outputs.imgname }}
|
|
||||||
version: ${{ needs.build.outputs.version }}
|
|
||||||
run: |
|
|
||||||
unzip -q /tmp/${imgname}-docker-${version}.zip -d /tmp
|
|
||||||
docker load < /tmp/${imgname}-docker-${version}
|
|
||||||
- name: docker compose up
|
- name: docker compose up
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
env:
|
env:
|
||||||
|
@ -276,15 +268,10 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: emqx-docker-image-zip
|
name: emqx-docker-image
|
||||||
path: /tmp
|
path: /tmp
|
||||||
- name: load docker image
|
- name: load docker image
|
||||||
env:
|
run: docker load < /tmp/emqx.tar
|
||||||
imgname: ${{ needs.build.outputs.imgname }}
|
|
||||||
version: ${{ needs.build.outputs.version }}
|
|
||||||
run: |
|
|
||||||
unzip -q /tmp/${imgname}-docker-${version}.zip -d /tmp
|
|
||||||
docker load < /tmp/${imgname}-docker-${version}
|
|
||||||
- name: docker compose up
|
- name: docker compose up
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
id: install_erlang
|
id: install_erlang
|
||||||
with:
|
with:
|
||||||
otp-version: 23.2
|
otp-version: 23.2
|
||||||
- name: prepare
|
- name: make docker
|
||||||
run: |
|
run: |
|
||||||
if make emqx-ee --dry-run > /dev/null 2>&1; then
|
if make emqx-ee --dry-run > /dev/null 2>&1; then
|
||||||
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
||||||
|
@ -26,12 +26,12 @@ jobs:
|
||||||
make deps-emqx-ee
|
make deps-emqx-ee
|
||||||
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
|
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
|
||||||
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
||||||
|
make emqx-ee-docker
|
||||||
else
|
else
|
||||||
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
|
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
|
||||||
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
||||||
|
make emqx-docker
|
||||||
fi
|
fi
|
||||||
- name: make emqx image
|
|
||||||
run: make docker
|
|
||||||
- name: run emqx
|
- name: run emqx
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
run: |
|
run: |
|
||||||
|
@ -79,11 +79,11 @@ jobs:
|
||||||
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
|
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
|
||||||
make deps-emqx-ee
|
make deps-emqx-ee
|
||||||
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
|
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
|
||||||
|
make emqx-ee-docker
|
||||||
else
|
else
|
||||||
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
|
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
|
||||||
|
make emqx-docker
|
||||||
fi
|
fi
|
||||||
- name: make emqx image
|
|
||||||
run: make docker
|
|
||||||
- name: install k3s
|
- name: install k3s
|
||||||
env:
|
env:
|
||||||
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||||
|
|
Loading…
Reference in New Issue