From c246e758be780b1679867175be62f8d26865a417 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 12 Aug 2022 11:57:56 +0200 Subject: [PATCH 1/9] refactor(Makefile): always execute prepare-build-deps script --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 49c2b1ed7..6e68d5164 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ $(shell $(CURDIR)/scripts/git-hooks-init.sh) +$(shell $(CURDIR)/scripts/prepare-build-deps.sh) REBAR = $(CURDIR)/rebar3 BUILD = $(CURDIR)/build SCRIPTS = $(CURDIR)/scripts @@ -111,7 +112,7 @@ cover: $(REBAR) coveralls: $(REBAR) @ENABLE_COVER_COMPILE=1 $(REBAR) as test coveralls send -COMMON_DEPS := $(REBAR) prepare-build-deps get-dashboard conf-segs +COMMON_DEPS := $(REBAR) get-dashboard conf-segs ELIXIR_COMMON_DEPS := ensure-hex ensure-mix-rebar3 ensure-mix-rebar .PHONY: $(REL_PROFILES) @@ -219,9 +220,6 @@ conf-segs: @scripts/merge-config.escript @scripts/merge-i18n.escript -prepare-build-deps: - @scripts/prepare-build-deps.sh - ## elixir target is to create release packages using Elixir's Mix .PHONY: $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir) $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir): $(COMMON_DEPS) $(ELIXIR_COMMON_DEPS) mix-deps-get From c82a05a0e73db11444260bc1de07373408ad94b3 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 12 Aug 2022 13:17:22 +0200 Subject: [PATCH 2/9] refactor(Makefile): support download enterprise dashboard download --- Makefile | 16 ++++++++++------ build | 2 ++ scripts/get-dashboard.sh | 16 ++++++++++++++-- scripts/pre-compile.sh | 23 +++++++++++++++++++++++ 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100755 scripts/pre-compile.sh diff --git a/Makefile b/Makefile index 6e68d5164..0ec95d4e7 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ export EMQX_DEFAULT_RUNNER = debian:11-slim export OTP_VSN ?= $(shell $(CURDIR)/scripts/get-otp-vsn.sh) export ELIXIR_VSN ?= $(shell $(CURDIR)/scripts/get-elixir-vsn.sh) export EMQX_DASHBOARD_VERSION ?= v1.0.6 +export EMQX_EE_DASHBOARD_VERSION ?= e1.0.0 export EMQX_REL_FORM ?= tgz export QUICER_DOWNLOAD_FROM_RELEASE = 1 ifeq ($(OS),Windows_NT) @@ -56,10 +57,6 @@ mix-deps-get: $(ELIXIR_COMMON_DEPS) $(REBAR): ensure-rebar3 -.PHONY: get-dashboard -get-dashboard: - @$(SCRIPTS)/get-dashboard.sh - .PHONY: eunit eunit: $(REBAR) conf-segs @ENABLE_COVER_COMPILE=1 $(REBAR) eunit -v -c @@ -81,7 +78,12 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh) ## app/name-ct targets are intended for local tests hence cover is not enabled .PHONY: $(APPS:%=%-ct) define gen-app-ct-target -$1-ct: $(REBAR) conf-segs +$1-ct: $(REBAR) +ifeq (,$(findstring lib-ee,$1)) + @./scripts/pre-compile.sh emqx +else + @./scripts/pre-compile.sh emqx-enterprise +endif @ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(CURDIR)/scripts/find-suites.sh $1) endef $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app)))) @@ -112,7 +114,8 @@ cover: $(REBAR) coveralls: $(REBAR) @ENABLE_COVER_COMPILE=1 $(REBAR) as test coveralls send -COMMON_DEPS := $(REBAR) get-dashboard conf-segs +COMMON_DEPS := $(REBAR) + ELIXIR_COMMON_DEPS := ensure-hex ensure-mix-rebar3 ensure-mix-rebar .PHONY: $(REL_PROFILES) @@ -148,6 +151,7 @@ deps-all: $(REBAR) $(PROFILES:%=deps-%) ## which may not have the right credentials .PHONY: $(PROFILES:%=deps-%) $(PROFILES:%=deps-%): $(COMMON_DEPS) + @./scripts/pre-compile.sh $(@:deps-%=%) @$(REBAR) as $(@:deps-%=%) get-deps @rm -f rebar.lock diff --git a/build b/build index 07c16b69e..80dbe2775 100755 --- a/build +++ b/build @@ -106,6 +106,7 @@ assert_no_compile_time_only_deps() { } make_rel() { + ./scripts/pre-compile.sh $PROFILE # compile all beams ./rebar3 as "$PROFILE" compile # generate docs (require beam compiled), generated to etc and priv dirs @@ -116,6 +117,7 @@ make_rel() { } make_elixir_rel() { + ./scripts/pre-compile.sh "$PROFILE" export_release_vars "$PROFILE" mix release --overwrite assert_no_compile_time_only_deps diff --git a/scripts/get-dashboard.sh b/scripts/get-dashboard.sh index 481a932ee..0069f3cc2 100755 --- a/scripts/get-dashboard.sh +++ b/scripts/get-dashboard.sh @@ -5,8 +5,20 @@ set -euo pipefail # ensure dir cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." -RELEASE_ASSET_FILE="emqx-dashboard.zip" -VERSION="${EMQX_DASHBOARD_VERSION}" +VERSION="${1}" +case "$VERSION" in + v*) + RELEASE_ASSET_FILE="emqx-dashboard.zip" + ;; + e*) + RELEASE_ASSET_FILE="emqx-enterprise-dashboard.zip" + ;; + *) + echo "Unknown version $VERSION" + exit 1 + ;; +esac + DASHBOARD_PATH='apps/emqx_dashboard/priv' DASHBOARD_REPO='emqx-dashboard-web-new' DIRECT_DOWNLOAD_URL="https://github.com/emqx/${DASHBOARD_REPO}/releases/download/${VERSION}/${RELEASE_ASSET_FILE}" diff --git a/scripts/pre-compile.sh b/scripts/pre-compile.sh new file mode 100755 index 000000000..0fe99c6b2 --- /dev/null +++ b/scripts/pre-compile.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# NOTE: PROFILE_STR may not be exactly PROFILE (emqx or emqx-enterprise) +# it might be with suffix such as -pkg etc. +PROFILE_STR="${1}" + +case "$PROFILE_STR" in + *enterprise*) + dashboard_version="$EMQX_EE_DASHBOARD_VERSION" + ;; + *) + dashboard_version="$EMQX_DASHBOARD_VERSION" + ;; +esac + +# ensure dir +cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." + +./scripts/get-dashboard.sh "$dashboard_version" +./scripts/merge-config.escript +./scripts/merge-i18n.escript From fbb97b16be7af930c3b92acfddf5adff5120ca0d Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 12 Aug 2022 14:18:55 +0200 Subject: [PATCH 3/9] ci: test all apps with dual profile no need to test emqx-enterprise profile if the EMQX_RELEASE_EDITION compilation flag is not used though --- .github/workflows/run_test_cases.yaml | 20 +++++++++++++++++++- Makefile | 6 +----- build | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index e08e3906b..4b76938c0 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -145,6 +145,10 @@ jobs: fail-fast: false matrix: app_name: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }} + profile: + - emqx + - emqx-enterprise + runs-on: aws-amd64 container: "ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04" defaults: @@ -163,8 +167,22 @@ jobs: # produces .coverdata - name: run common test working-directory: source + env: + PROFILE: ${{ matrix.profile }} + WHICH_APP: ${{ matrix.app_name }} run: | - make ${{ matrix.app_name }}-ct + if [ "$PROFILE" = 'emqx-enterprise' ]; then + COMPILE_FLAGS="$(grep -R "EMQX_RELEASE_EDITION" "$WHICH_APP" | wc -l || true)" + if [ "$COMPILE_FLAGS" -gt 0 ]; then + # need to clean first because the default profile was + make clean + make "${WHICH_APP}-ct" + else + echo "no_common_test_run_for_app ${WHICH_APP}" + fi + else + make "${WHICH_APP}-ct" + fi - uses: actions/upload-artifact@v1 with: name: coverdata diff --git a/Makefile b/Makefile index 0ec95d4e7..5bb3f0caf 100644 --- a/Makefile +++ b/Makefile @@ -79,11 +79,7 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh) .PHONY: $(APPS:%=%-ct) define gen-app-ct-target $1-ct: $(REBAR) -ifeq (,$(findstring lib-ee,$1)) - @./scripts/pre-compile.sh emqx -else - @./scripts/pre-compile.sh emqx-enterprise -endif + @./scripts/pre-compile.sh $(PROFILE) @ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(CURDIR)/scripts/find-suites.sh $1) endef $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app)))) diff --git a/build b/build index 80dbe2775..703692000 100755 --- a/build +++ b/build @@ -106,7 +106,7 @@ assert_no_compile_time_only_deps() { } make_rel() { - ./scripts/pre-compile.sh $PROFILE + ./scripts/pre-compile.sh "$PROFILE" # compile all beams ./rebar3 as "$PROFILE" compile # generate docs (require beam compiled), generated to etc and priv dirs From b8d5ec47f7c7aa0c85de9ca25cb960bd76645931 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 12 Aug 2022 15:49:23 +0200 Subject: [PATCH 4/9] fix(Makefile): make use of the FORCE target --- Makefile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 5bb3f0caf..2c3077acc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -$(shell $(CURDIR)/scripts/git-hooks-init.sh) -$(shell $(CURDIR)/scripts/prepare-build-deps.sh) REBAR = $(CURDIR)/rebar3 BUILD = $(CURDIR)/build SCRIPTS = $(CURDIR)/scripts @@ -32,6 +30,13 @@ export REBAR_GIT_CLONE_OPTIONS += --depth=1 .PHONY: default default: $(REBAR) $(PROFILE) +.PHONY: prepare +prepare: FORCE + @$(SCRIPTS)/git-hooks-init.sh # this is no longer needed since 5.0 but we keep it anyway + @$(SCRIPTS)/prepare-build-deps.sh + +FORCE: + .PHONY: all all: $(REBAR) $(PROFILES) @@ -55,7 +60,7 @@ ensure-mix-rebar: $(REBAR) mix-deps-get: $(ELIXIR_COMMON_DEPS) @mix deps.get -$(REBAR): ensure-rebar3 +$(REBAR): prepare ensure-rebar3 .PHONY: eunit eunit: $(REBAR) conf-segs @@ -73,14 +78,14 @@ ct: $(REBAR) conf-segs static_checks: @$(REBAR) as check do dialyzer, xref, ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE) -APPS=$(shell $(CURDIR)/scripts/find-apps.sh) +APPS=$(shell $(SCRIPTS)/find-apps.sh) ## app/name-ct targets are intended for local tests hence cover is not enabled .PHONY: $(APPS:%=%-ct) define gen-app-ct-target $1-ct: $(REBAR) - @./scripts/pre-compile.sh $(PROFILE) - @ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(CURDIR)/scripts/find-suites.sh $1) + @$(SCRIPTS)/pre-compile.sh $(PROFILE) + @ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v --cover_export_name $(subst /,-,$1) --suite $(shell $(SCRIPTS)/find-suites.sh $1) endef $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app)))) @@ -88,7 +93,7 @@ $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app)))) .PHONY: $(APPS:%=%-prop) define gen-app-prop-target $1-prop: - $(REBAR) proper -d test/props -v -m $(shell $(CURDIR)/scripts/find-props.sh $1) + $(REBAR) proper -d test/props -v -m $(shell $(SCRIPTS)/find-props.sh $1) endef $(foreach app,$(APPS),$(eval $(call gen-app-prop-target,$(app)))) @@ -147,7 +152,7 @@ deps-all: $(REBAR) $(PROFILES:%=deps-%) ## which may not have the right credentials .PHONY: $(PROFILES:%=deps-%) $(PROFILES:%=deps-%): $(COMMON_DEPS) - @./scripts/pre-compile.sh $(@:deps-%=%) + @$(SCRIPTS)/pre-compile.sh $(@:deps-%=%) @$(REBAR) as $(@:deps-%=%) get-deps @rm -f rebar.lock @@ -168,7 +173,7 @@ $(REL_PROFILES:%=%-rel) $(PKG_PROFILES:%=%-rel): $(COMMON_DEPS) .PHONY: $(REL_PROFILES:%=%-relup-downloads) define download-relup-packages $1-relup-downloads: - @if [ "$${EMQX_RELUP}" = "true" ]; then $(CURDIR)/scripts/relup-build/download-base-packages.sh $1; fi + @if [ "$${EMQX_RELUP}" = "true" ]; then $(SCRIPTS)/relup-build/download-base-packages.sh $1; fi endef ALL_ZIPS = $(REL_PROFILES) $(foreach zt,$(ALL_ZIPS),$(eval $(call download-relup-packages,$(zt)))) @@ -217,8 +222,8 @@ $(foreach zt,$(ALL_DOCKERS),$(eval $(call gen-docker-target,$(zt)))) .PHONY: conf-segs: - @scripts/merge-config.escript - @scripts/merge-i18n.escript + @$(SCRIPTS)/merge-config.escript + @$(SCRIPTS)/merge-i18n.escript ## elixir target is to create release packages using Elixir's Mix .PHONY: $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir) @@ -245,6 +250,6 @@ $(foreach tt,$(ALL_ELIXIR_TGZS),$(eval $(call gen-elixir-tgz-target,$(tt)))) .PHONY: fmt fmt: $(REBAR) - @./scripts/erlfmt -w '{apps,lib-ee}/*/{src,include,test}/**/*.{erl,hrl,app.src}' - @./scripts/erlfmt -w 'rebar.config.erl' + @$(SCRIPTS)/erlfmt -w '{apps,lib-ee}/*/{src,include,test}/**/*.{erl,hrl,app.src}' + @$(SCRIPTS)/erlfmt -w 'rebar.config.erl' @mix format From 4949fb222e8864e569cd5af39942fadb3f0c433f Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 13 Aug 2022 10:12:33 +0200 Subject: [PATCH 5/9] ci(test): do not fail coverdata uppload if no file found the optional make -ct action should not fail the following upload action --- .github/workflows/run_test_cases.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index 4b76938c0..50569db3e 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -178,16 +178,17 @@ jobs: make clean make "${WHICH_APP}-ct" else - echo "no_common_test_run_for_app ${WHICH_APP}" + echo "no_common_test_run_for_app ${WHICH_APP}-ct" fi else make "${WHICH_APP}-ct" fi - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v3 with: name: coverdata path: source/_build/test/cover - - uses: actions/upload-artifact@v1 + if-no-files-found: warn # do not fail if no coverdata found + - uses: actions/upload-artifact@v3 if: failure() with: name: logs_${{ matrix.otp_release }} From c93829c784fde0060e8b28398936ec20139e0bf3 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 13 Aug 2022 10:38:22 +0200 Subject: [PATCH 6/9] build: pass build profile as environment variable --- build | 11 ++++++++++- rebar.config.erl | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/build b/build index 703692000..99728d03e 100755 --- a/build +++ b/build @@ -14,9 +14,18 @@ if [ "$DEBUG" -eq 1 ]; then set -x fi -PROFILE="$1" +PROFILE_ARG="$1" ARTIFACT="$2" +if [[ "${PROFILE:-${PROFILE_ARG}}" != "$PROFILE_ARG" ]]; then + echo "PROFILE env var is set to '$PROFILE', but '$0' arg1 is '$1'" + exit 1 +fi + +# make sure PROFILE is exported, it is needed by rebar.config.erl +PROFILE=$PROFILE_ARG +export PROFILE + # ensure dir cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" diff --git a/rebar.config.erl b/rebar.config.erl index 976c0d3b8..18e2cafc0 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -4,6 +4,7 @@ do(Dir, CONFIG) -> ok = assert_otp(), + ok = warn_profile_env(), case iolist_to_binary(Dir) of <<".">> -> C1 = deps(CONFIG), @@ -117,6 +118,9 @@ is_raspbian() -> is_win32() -> win32 =:= element(1, os:type()). +project_app_dirs() -> + project_app_dirs(get_edition_from_profille_env()). + project_app_dirs(Edition) -> ["apps/*"] ++ case is_enterprise(Edition) of @@ -149,6 +153,9 @@ test_deps() -> {er_coap_client, {git, "https://github.com/emqx/er_coap_client", {tag, "v1.0.5"}}} ]. +common_compile_opts(Vsn) -> + common_compile_opts(get_edition_from_profille_env(), Vsn). + common_compile_opts(Edition, Vsn) -> % always include debug_info [ @@ -159,6 +166,32 @@ common_compile_opts(Edition, Vsn) -> [{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1"] ++ [{d, 'BUILD_WITHOUT_QUIC'} || not is_quicer_supported()]. +warn_profile_env() -> + case os:getenv("PROFILE") of + false -> + io:format( + standard_error, + "WARN: environment variable PROFILE is not set, using 'emqx-enterprise'~n", + [] + ); + _ -> + ok + end. + +%% this function is only used for test/check profiles +get_edition_from_profille_env() -> + case os:getenv("PROFILE") of + "emqx" -> + ce; + "emqx-enterprise" -> + ee; + false -> + ee; + V -> + io:format(standard_error, "ERROR: bad_PROFILE ~p~n", [V]), + exit(bad_PROFILE) + end. + prod_compile_opts(Edition, Vsn) -> [ compressed, @@ -212,14 +245,14 @@ profiles_dev() -> Vsn = get_vsn('emqx-enterprise'), [ {check, [ - {erl_opts, common_compile_opts(ee, Vsn)}, - {project_app_dirs, project_app_dirs(ee)} + {erl_opts, common_compile_opts(Vsn)}, + {project_app_dirs, project_app_dirs()} ]}, {test, [ {deps, test_deps()}, - {erl_opts, common_compile_opts(ee, Vsn) ++ erl_opts_i()}, + {erl_opts, common_compile_opts(Vsn) ++ erl_opts_i()}, {extra_src_dirs, [{"test", [{recursive, true}]}]}, - {project_app_dirs, project_app_dirs(ee)} + {project_app_dirs, project_app_dirs()} ]} ]. From d63d6b5f27575a39b7f4792108f0e2e61c241a52 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 13 Aug 2022 21:04:48 +0200 Subject: [PATCH 7/9] ci: do not run opensource edition test for lib-ee apps --- .github/workflows/run_test_cases.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index 50569db3e..3b65fe885 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -178,10 +178,17 @@ jobs: make clean make "${WHICH_APP}-ct" else - echo "no_common_test_run_for_app ${WHICH_APP}-ct" + echo "skip_common_test_run_for_app ${WHICH_APP}-ct" fi else - make "${WHICH_APP}-ct" + case "$WHICH_APP" in + lib-ee/*) + echo "skip_opensource_edition_test_for_lib-ee" + ;; + *) + make "${WHICH_APP}-ct" + ;; + esac fi - uses: actions/upload-artifact@v3 with: From 59dfde04a99cba66989eeb780b91e6f23d333e86 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 13 Aug 2022 21:07:13 +0200 Subject: [PATCH 8/9] build: match emqx-pkg profile --- rebar.config.erl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rebar.config.erl b/rebar.config.erl index 18e2cafc0..a4265cae3 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -183,8 +183,12 @@ get_edition_from_profille_env() -> case os:getenv("PROFILE") of "emqx" -> ce; + "emqx-" ++ _ -> + ce; "emqx-enterprise" -> ee; + "emqx-enterprise-" ++ _ -> + ee; false -> ee; V -> From cd0114b3dc4cf344d31860c1a6333b87865335ab Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Sun, 14 Aug 2022 17:57:11 +0800 Subject: [PATCH 9/9] fix: ensure PROFILE=emqx when running make emqx-elixir --- deploy/docker/Dockerfile | 7 ++++--- deploy/docker/Dockerfile.alpine | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 5cc247977..6c5baa391 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -7,14 +7,15 @@ COPY . /emqx ARG EMQX_NAME=emqx ENV EMQX_RELUP=false -RUN export PROFILE="$EMQX_NAME" \ - && export EMQX_NAME=${EMQX_NAME%%-elixir} \ +RUN export PROFILE=${EMQX_NAME%%-elixir} \ + && export EMQX_NAME1=$EMQX_NAME \ + && export EMQX_NAME=$PROFILE \ && export EMQX_LIB_PATH="_build/$EMQX_NAME/lib" \ && export EMQX_REL_PATH="/emqx/_build/$EMQX_NAME/rel/emqx" \ && export EMQX_REL_FORM='docker' \ && cd /emqx \ && rm -rf $EMQX_LIB_PATH \ - && make $PROFILE \ + && make $EMQX_NAME1 \ && mkdir -p /emqx-rel \ && mv $EMQX_REL_PATH /emqx-rel diff --git a/deploy/docker/Dockerfile.alpine b/deploy/docker/Dockerfile.alpine index a8aee2f50..6368a0b51 100644 --- a/deploy/docker/Dockerfile.alpine +++ b/deploy/docker/Dockerfile.alpine @@ -28,14 +28,15 @@ COPY . /emqx ARG EMQX_NAME=emqx ENV EMQX_RELUP=false -RUN export PROFILE="$EMQX_NAME" \ - && export EMQX_NAME=${EMQX_NAME%%-elixir} \ +RUN export PROFILE=${EMQX_NAME%%-elixir} \ + && export EMQX_NAME1=$EMQX_NAME \ + && export EMQX_NAME=$PROFILE \ && export EMQX_LIB_PATH="_build/$EMQX_NAME/lib" \ && export EMQX_REL_PATH="/emqx/_build/$EMQX_NAME/rel/emqx" \ && export EMQX_REL_FORM='docker' \ && cd /emqx \ && rm -rf $EMQX_LIB_PATH \ - && make $PROFILE \ + && make $EMQX_NAME1 \ && mkdir -p /emqx-rel \ && mv $EMQX_REL_PATH /emqx-rel