This is an automated email from the ASF dual-hosted git repository.

dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 44478ae11 [type:build] provide the Makefile to easier to build image 
(#3980)
44478ae11 is described below

commit 44478ae11aa7a6c396342fe718bcc98f9a549bcf
Author: Luke.Z <[email protected]>
AuthorDate: Thu Sep 22 13:08:01 2022 +0800

    [type:build] provide the Makefile to easier to build image (#3980)
    
    * provide the Makefile to easier to build image
    
    * update filters.yml
---
 .github/filters.yml |  1 +
 Makefile            | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+)

diff --git a/.github/filters.yml b/.github/filters.yml
index b92bc0e3a..a280da3cd 100644
--- a/.github/filters.yml
+++ b/.github/filters.yml
@@ -4,6 +4,7 @@ changed:
     resources/static/**,\
     .asf.yaml,.gitignore,.licenserc.yaml,\
     LICENSE,NOTICE,\
+    Makefile,\
     .github/(ISSUE_TEMPLATE/**|PULL_REQUEST_TEMPLATE)\
     }"
 pom:
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..adbaf65ec
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,99 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SHENYU_HOME :=  "."
+VERSION := "2.5.1-SNAPSHOT"
+
+REGISTRY = "docker.io"
+REPOSITORY_PREF := "apache/shenyu"
+ADMIN_REPOSITORY := "${REPOSITORY_PREF}-admin"
+BOOTSTRAP_REPOSITORY := "${REPOSITORY_PREF}-admin"
+
+TAG := latest
+
+default: build-all-image
+
+build-all: build-admin build-bootstrap
+       @echo "build all"
+
+build-admin:
+       @echo "build admin"
+       @cd ${SHENYU_HOME} && \
+               ./mvnw -am \
+               -pl shenyu-dist/shenyu-admin-dist \
+               -Dmaven.javadoc.skip=true \
+               -Drat.skip=true \
+               -Djacoco.skip=true \
+               -DskipTests \
+               -Prelease \
+               clean package
+
+build-bootstrap:
+       @echo "build bootstrap"
+       @cd ${SHENYU_HOME} && \
+               ./mvnw -am \
+               -pl shenyu-dist/shenyu-bootstrap-dist \
+               -Dmaven.javadoc.skip=true \
+               -Drat.skip=true \
+               -Djacoco.skip=true \
+               -DskipTests \
+               -Prelease \
+               clean package
+
+build-all-image: build-admin-image build-bootstrap-image ## build images on 
local, does not support multi platforms.
+       @echo "build images"
+
+build-admin-image: build-admin ## build admin image for local
+       @echo "build admin image"
+       @docker buildx build --load \
+               -t ${REGISTRY}/${ADMIN_REPOSITORY}:${TAG} \
+               -f ${SHENYU_HOME}/shenyu-dist/shenyu-admin-dist/Dockerfile \
+               --build-arg APP_NAME=apache-shenyu-${VERSION}-admin-bin \
+               ${SHENYU_HOME}/shenyu-dist/shenyu-admin-dist
+
+build-bootstrap-image: build-bootstrap ## build bootstrap image for local
+       @echo "build bootstrap image"
+       @docker buildx build --load \
+               -t ${REGISTRY}/${BOOTSTRAP_REPOSITORY}:${TAG} \
+               -f ${SHENYU_HOME}/shenyu-dist/shenyu-bootstrap-dist/Dockerfile \
+               --build-arg APP_NAME=apache-shenyu-${VERSION}-bootstrap-bin \
+               ${SHENYU_HOME}/shenyu-dist/shenyu-bootstrap-dist
+
+publish-all-images: init publish-admin-image publish-bootstrap-image ## build 
and publish images on buildx, for producing multi platform images
+       @docker buildx rm shenyu
+
+.PHONY: init
+init:
+       @docker buildx create --name shenyu
+       @docker buildx use shenyu
+
+publish-admin-image: build-admin
+       @docker buildx rm shenyu
+       @docker buildx build --push \
+               --platform=linux/arm64,linux/amd64 \
+               -t ${REGISTRY}/${ADMIN_REPOSITORY}:latest \
+               -t ${REGISTRY}/${ADMIN_REPOSITORY}:${VERSION} \
+               --build-arg APP_NAME=apache-shenyu-${VERSION}-admin-bin \
+               -f ${SHENYU_HOME}/shenyu-dist/shenyu-admin-dist/Dockerfile \
+               ${SHENYU_HOME}/shenyu-dist/shenyu-admin-dist
+
+publish-bootstrap-image: build-bootstrap
+       @docker buildx build --push \
+               --platform=linux/arm64,linux/amd64 \
+               -t ${REGISTRY}/${BOOSTRAP_REPOSITORY}:latest \
+               -t ${REGISTRY}/${BOOSTRAP_REPOSITORY}:${VERSION} \
+               --build-arg APP_NAME=apache-shenyu-${VERSION}-bootstrap-bin \
+               -f ${SHENYU_HOME}/shenyu-dist/shenyu-bootstrap-dist/Dockerfile \
+               ${SHENYU_HOME}/shenyu-dist/shenyu-bootstrap-dist

Reply via email to