chore(CI): better build docker image
This commit is contained in:
parent
e2f9b111b6
commit
d334b27e56
|
@ -356,62 +356,37 @@ 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
|
||||||
- uses: docker/build-push-action@v2
|
- uses: docker/metadata-action@v3
|
||||||
if: github.event_name != 'release'
|
id: meta
|
||||||
with:
|
with:
|
||||||
push: false
|
images: ${{ github.repository_owner }}/${{ matrix.profile }}
|
||||||
pull: true
|
flavor: |
|
||||||
no-cache: true
|
latest=${{ !github.event.release.prerelease }}
|
||||||
platforms: linux/amd64,linux/arm64
|
tags: |
|
||||||
tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }}
|
type=ref,event=branch
|
||||||
build-args: |
|
type=ref,event=pr
|
||||||
PKG_VSN=${{ steps.version.outputs.version }}
|
type=ref,event=tag
|
||||||
BUILD_FROM=ghcr.io/emqx/emqx-builder-helper/5.0:${{ matrix.otp }}-alpine3.14
|
type=semver,pattern={{version}}
|
||||||
RUN_FROM=alpine:3.14
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
EMQX_NAME=${{ matrix.profile }}
|
|
||||||
file: source/deploy/docker/Dockerfile
|
|
||||||
context: source
|
|
||||||
- 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 }}
|
||||||
- uses: docker/build-push-action@v2
|
- uses: docker/build-push-action@v2
|
||||||
if: github.event_name == 'release' && github.event.release.prerelease
|
|
||||||
with:
|
with:
|
||||||
push: true
|
push: ${{ github.event_name == 'release' }}
|
||||||
pull: true
|
pull: true
|
||||||
no-cache: true
|
no-cache: true
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-args: |
|
build-args: |
|
||||||
PKG_VSN=${{ steps.version.outputs.version }}
|
|
||||||
BUILD_FROM=ghcr.io/emqx/emqx-builder-helper/5.0:${{ matrix.otp }}-alpine3.14
|
|
||||||
RUN_FROM=alpine:3.14
|
|
||||||
EMQX_NAME=${{ matrix.profile }}
|
|
||||||
file: source/deploy/docker/Dockerfile
|
|
||||||
context: source
|
|
||||||
- uses: docker/build-push-action@v2
|
|
||||||
if: github.event_name == 'release' && !github.event.release.prerelease
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
pull: true
|
|
||||||
no-cache: true
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
tags: |
|
|
||||||
emqx/${{ matrix.profile }}:latest
|
|
||||||
emqx/${{ matrix.profile }}:${{ steps.version.outputs.version }}
|
|
||||||
build-args: |
|
|
||||||
PKG_VSN=${{ steps.version.outputs.version }}
|
|
||||||
BUILD_FROM=ghcr.io/emqx/emqx-builder-helper/5.0:${{ matrix.otp }}-alpine3.14
|
BUILD_FROM=ghcr.io/emqx/emqx-builder-helper/5.0:${{ matrix.otp }}-alpine3.14
|
||||||
RUN_FROM=alpine:3.14
|
RUN_FROM=alpine:3.14
|
||||||
EMQX_NAME=${{ matrix.profile }}
|
EMQX_NAME=${{ matrix.profile }}
|
||||||
|
|
|
@ -20,7 +20,6 @@ RUN apk add --no-cache \
|
||||||
|
|
||||||
COPY . /emqx
|
COPY . /emqx
|
||||||
|
|
||||||
ARG PKG_VSN
|
|
||||||
ARG EMQX_NAME=emqx
|
ARG EMQX_NAME=emqx
|
||||||
|
|
||||||
RUN cd /emqx \
|
RUN cd /emqx \
|
||||||
|
@ -29,17 +28,6 @@ RUN cd /emqx \
|
||||||
|
|
||||||
FROM $RUN_FROM
|
FROM $RUN_FROM
|
||||||
|
|
||||||
# Basic build-time metadata as defined at http://label-schema.org
|
|
||||||
LABEL org.label-schema.docker.dockerfile="Dockerfile" \
|
|
||||||
org.label-schema.license="GNU" \
|
|
||||||
org.label-schema.name="emqx" \
|
|
||||||
org.label-schema.version=${PKG_VSN} \
|
|
||||||
org.label-schema.description="EMQ (Erlang MQTT Broker) is a distributed, massively scalable, highly extensible MQTT messaging broker written in Erlang/OTP." \
|
|
||||||
org.label-schema.url="https://emqx.io" \
|
|
||||||
org.label-schema.vcs-type="Git" \
|
|
||||||
org.label-schema.vcs-url="https://github.com/emqx/emqx" \
|
|
||||||
maintainer="Raymond M Mouthaan <raymondmmouthaan@gmail.com>, Huang Rui <vowstar@gmail.com>, EMQ X Team <support@emqx.io>"
|
|
||||||
|
|
||||||
ARG EMQX_NAME=emqx
|
ARG EMQX_NAME=emqx
|
||||||
|
|
||||||
COPY deploy/docker/docker-entrypoint.sh /usr/bin/
|
COPY deploy/docker/docker-entrypoint.sh /usr/bin/
|
||||||
|
|
Loading…
Reference in New Issue