You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/01/26 04:07:47 UTC

[skywalking-java] 01/01: Migrate base images to Temurin and add images for ARM

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

kezhenxu94 pushed a commit to branch docker/arm
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git

commit 992a2a234a934ba2fab8fadc02bd17c73febb95f
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Jan 26 12:04:16 2022 +0800

    Migrate base images to Temurin and add images for ARM
---
 .github/workflows/publish-docker.yaml |  3 ++-
 Dockerfile                            |  4 ++--
 Makefile                              | 45 ++++++++++++++++-------------------
 docs/en/contribution/compiling.md     |  2 +-
 4 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index d92d878..ca59849 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -20,6 +20,7 @@ on:
   push:
     branches:
       - main
+      - docker/arm
 
 env:
   SKIP_TEST: true
@@ -60,7 +61,7 @@ jobs:
     timeout-minutes: 60
     strategy:
       matrix:
-        java-version: [ 8, 11, 12, 13, 14, 15, 16, 17 ]
+        java-version: [ 8, 11, 17 ]
     env:
       TAG: ${{ github.sha }}
     steps:
diff --git a/Dockerfile b/Dockerfile
index bbedf37..08b4274 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ARG BASE_IMAGE='adoptopenjdk/openjdk8:alpine-jre'
+ARG BASE_IMAGE='eclipse-temurin:8-jre-focal'
 
 ARG SKYWALKING_CLI_VERSION
 
@@ -24,7 +24,7 @@ FROM $BASE_IMAGE
 
 ARG DIST=skywalking-agent
 
-RUN apk add --no-cache openssl
+RUN apk add --no-cache openssl || true
 
 LABEL maintainer="kezhenxu94@apache.org"
 
diff --git a/Makefile b/Makefile
index b3b3ffc..ec1ca47 100644
--- a/Makefile
+++ b/Makefile
@@ -34,35 +34,32 @@ dist: build
 
 # Docker build
 
-base.adopt := java8 java11 java12 java13 java14 java15 java16
-base.temurin := java17
-
-base.all := alpine $(base.adopt) $(base.temurin)
+base.all := alpine java8 java11 java17
 base.each = $(word 1, $@)
 
 base.image.alpine := alpine:3
-base.image.java8 := adoptopenjdk/openjdk8:alpine-jre
-base.image.java11 := adoptopenjdk/openjdk11:alpine-jre
-base.image.java12 := adoptopenjdk/openjdk12:alpine-jre
-base.image.java13 := adoptopenjdk/openjdk13:alpine-jre
-base.image.java14 := adoptopenjdk/openjdk14:alpine-jre
-base.image.java15 := adoptopenjdk/openjdk15:alpine-jre
-base.image.java16 := adoptopenjdk/openjdk16:alpine-jre
-base.image.java17 := eclipse-temurin:17-alpine
+base.image.java8 := eclipse-temurin:8-jre
+base.image.java11 := eclipse-temurin:11-jre
+base.image.java17 := eclipse-temurin:17-jre
+
+docker.%: PLATFORMS =
+docker.%: LOAD_OR_PUSH = --load
+docker.push.%: PLATFORMS = --platform linux/amd64,linux/arm64
+docker.push.%: LOAD_OR_PUSH = --push
 
 .PHONY: $(base.all)
 $(base.all:%=docker.%): BASE_IMAGE=$($(base.each:docker.%=base.image.%))
-$(base.all:%=docker.%): docker.%: skywalking-agent
-	docker build --no-cache --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg DIST=$(AGENT_PACKAGE) --build-arg SKYWALKING_CLI_VERSION=$(CLI_VERSION) . -t $(HUB)/$(NAME):$(TAG)-$(base.each:docker.%=%)
+$(base.all:%=docker.push.%): BASE_IMAGE=$($(base.each:docker.push.%=base.image.%))
+$(base.all:%=docker.%) $(base.all:%=docker.push.%): skywalking-agent
+	docker buildx create --use --driver docker-container --name skywalking_main > /dev/null 2>&1 || true
+	docker buildx build $(PLATFORMS) $(LOAD_OR_PUSH) \
+        --no-cache \
+        --build-arg BASE_IMAGE=$(BASE_IMAGE) \
+        --build-arg DIST=$(AGENT_PACKAGE) \
+        --build-arg SKYWALKING_CLI_VERSION=$(CLI_VERSION) \
+        . -t $(HUB)/$(NAME):$(TAG)-$(base.each:docker.%=%)
+	docker buildx rm skywalking_main || true
 
-.PHONY: docker
+.PHONY: docker docker.push
 docker: $(base.all:%=docker.%)
-
-# Docker push
-
-.PHONY: $(base.all:%=docker.push.%)
-$(base.all:%=docker.push.%): docker.push.%: docker.%
-	docker push $(HUB)/$(NAME):$(TAG)-$(base.each:docker.push.%=%)
-
-.PHONY: docker.push
-docker.push: $(base.all:%=docker.%)
+docker.push: $(base.all:%=docker.push.%)
diff --git a/docs/en/contribution/compiling.md b/docs/en/contribution/compiling.md
index a166789..94d8d79 100644
--- a/docs/en/contribution/compiling.md
+++ b/docs/en/contribution/compiling.md
@@ -24,7 +24,7 @@ folders if you are using IntelliJ IDE.
 # Building Docker images
 
 After you have [compiled the project](#compiling-project) and have generated the `skywalking-agent` folder, you can
-build Docker images. [`make docker`] builds the agent Docker images based on `alpine` image and `java8 ~ java 17`
+build Docker images. [`make docker`] builds the agent Docker images based on `alpine` image, `java8`, `java11` and `java 17`
 images by default. If you want to only build part of the images, add suffix `.alpine` or `.java<x>` to the `make`
 target, for example: