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 2021/10/19 03:49:34 UTC

[skywalking] 01/01: chore: build `swctl` from CLI Docker image instead of building from source

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

kezhenxu94 pushed a commit to branch chore/cli
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 41699dad625942c8fef31c6890640cc25a3a5781
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Tue Oct 19 11:49:09 2021 +0800

    chore: build `swctl` from CLI Docker image instead of building from source
---
 Makefile                  |  2 +-
 docker/oap/Dockerfile.oap | 81 ++---------------------------------------------
 2 files changed, 4 insertions(+), 79 deletions(-)

diff --git a/Makefile b/Makefile
index a0127fa..7aa6b24 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
 CONTEXT ?= ${SW_ROOT}/dist
 SKIP_TEST ?= false
 DIST ?= apache-skywalking-apm-bin.tar.gz
-CLI_VERSION ?= 0.7.0 # CLI version inside OAP image should always use an Apache released artifact.
+CLI_VERSION ?= 0.9.0 # CLI version inside OAP image should always use an Apache released artifact.
 
 init:
 	cd $(SW_ROOT) && git submodule update --init --recursive
diff --git a/docker/oap/Dockerfile.oap b/docker/oap/Dockerfile.oap
index b53e10e..02b99ca 100644
--- a/docker/oap/Dockerfile.oap
+++ b/docker/oap/Dockerfile.oap
@@ -16,84 +16,9 @@
 
 ARG BASE_IMAGE='adoptopenjdk/openjdk11:alpine'
 
-FROM $BASE_IMAGE as cli
+ARG SKYWALKING_CLI_VERSION
 
-WORKDIR /skywalking
-
-ARG SKYWALKING_CLI_VERSION=0.7.0
-ENV SKYWALKING_CLI_TGZ=skywalking-cli-$SKYWALKING_CLI_VERSION-bin.tgz
-ENV SKYWALKING_CLI_ASC=${SKYWALKING_CLI_TGZ}.asc
-ENV SKYWALKING_CLI_SHA512=${SKYWALKING_CLI_TGZ}.sha512
-
-ENV SKYWALKING_CLI_TGZ_URLS \
-        https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
-        # if the version is outdated, we might have to pull from the dist/archive :/
-	    https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
-	    https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ \
-	    https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_TGZ
-
-ENV SKYWALKING_CLI_ASC_URLS \
-        https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
-        # if the version is outdated, we might have to pull from the dist/archive :/
-	    https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
-	    https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC \
-	    https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_ASC
-
-ENV SKYWALKING_CLI_SHA512_URLS \
-        https://www.apache.org/dyn/closer.cgi?action=download&filename=skywalking/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
-        # if the version is outdated, we might have to pull from the dist/archive :/
-	    https://www-us.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
-	    https://www.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512 \
-	    https://archive.apache.org/dist/skywalking/cli/$SKYWALKING_CLI_VERSION/$SKYWALKING_CLI_SHA512
-
-
-RUN set -eux; \
-	\
-	apk add --no-cache --virtual .fetch-deps \
-		gnupg \
-		ca-certificates \
-		openssl \
-	; \
-	\
-	wget --timeout=20 -O KEYS https://downloads.apache.org/skywalking/KEYS; \
-	gpg --import KEYS; \
-	\
-	success=; \
-	for url in $SKYWALKING_CLI_TGZ_URLS; do \
-		if wget --timeout=20  -O ${SKYWALKING_CLI_TGZ} "$url"; then \
-			success=1; \
-			break; \
-		fi; \
-	done; \
-	[ -n "$success" ]; \
-	\
-	success=; \
-	for url in $SKYWALKING_CLI_SHA512_URLS; do \
-		if wget --timeout=20  -O ${SKYWALKING_CLI_SHA512} "$url"; then \
-			success=1; \
-			break; \
-		fi; \
-	done; \
-	[ -n "$success" ]; \
-	\
-	sha512sum -c ${SKYWALKING_CLI_SHA512}; \
-	\
-	success=; \
-	for url in $SKYWALKING_CLI_ASC_URLS; do \
-		if wget --timeout=20  -O ${SKYWALKING_CLI_ASC} "$url"; then \
-			success=1; \
-			break; \
-		fi; \
-	done; \
-	[ -n "$success" ]; \
-	\
-	gpg --batch --verify ${SKYWALKING_CLI_ASC} ${SKYWALKING_CLI_TGZ}; \
-	tar -xvf ${SKYWALKING_CLI_TGZ}; \
-    mkdir "bin/"; \
-	mv skywalking-cli-${SKYWALKING_CLI_VERSION}-bin/bin/swctl-${SKYWALKING_CLI_VERSION}-linux-amd64 bin/swctl; \
-	chmod 755 bin/*; \
-	command -v gpgconf && gpgconf --kill all || :; \
-	ls -la .;
+FROM apache/skywalking-cli:$SKYWALKING_CLI_VERSION as cli
 
 FROM $BASE_IMAGE
 
@@ -116,7 +41,7 @@ RUN set -ex; \
     rm -rf "agent"; \
     mkdir "bin";
 
-COPY --from=cli /skywalking/bin/swctl ./bin
+COPY --from=cli /swctl ./bin
 
 COPY log4j2.xml config/
 COPY docker-entrypoint.sh .