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/09/08 12:53:18 UTC

[skywalking] 02/02: Move Dockerfiles in apache/skywalking-docker

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

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

commit 9a8e87eb8a5948ae1e181d7629947022c5335c50
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Sep 8 20:52:51 2021 +0800

    Move Dockerfiles in apache/skywalking-docker
---
 Makefile                         | 22 +++++++++-------------
 docker/oap/Dockerfile.oap        | 31 ++++++++++++++++---------------
 docker/ui/Dockerfile.ui          | 25 +++++++++++++------------
 docs/en/guides/How-to-release.md | 18 +++++++++++++++++-
 4 files changed, 55 insertions(+), 41 deletions(-)

diff --git a/Makefile b/Makefile
index 2d79471..ae8d4b0 100644
--- a/Makefile
+++ b/Makefile
@@ -16,14 +16,11 @@
 
 SHELL := /bin/bash -o pipefail
 
-export SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
-
-export SW_OUT:=${SW_ROOT}/dist
-
-CLI_CODE_VERSION ?= 0.7.0
-
+SW_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+SW_OUT ?= ${SW_ROOT}/dist
 SKIP_TEST ?= false
-DIST_NAME := apache-skywalking-apm-bin
+DIST ?= apache-skywalking-apm-bin.tar.gz
+CLI_CODE_VERSION ?= 0.7.0 # CLI version inside OAP image should always use an Apache released artifact.
 
 init:
 	cd $(SW_ROOT) && git submodule update --init --recursive
@@ -41,9 +38,8 @@ build.ui:
 
 DOCKER_BUILD_TOP:=${SW_OUT}/docker_build
 
-HUB?=skywalking
-
-TAG?=latest
+HUB ?= skywalking
+TAG ?= latest
 
 .SECONDEXPANSION: #allow $@ to be used in dependency list
 
@@ -59,15 +55,15 @@ ifneq ($(SW_OAP_BASE_IMAGE),)
   BUILD_ARGS := $(BUILD_ARGS) --build-arg BASE_IMAGE=$(SW_OAP_BASE_IMAGE)
 endif
 
-BUILD_ARGS := $(BUILD_ARGS) --build-arg DIST_NAME=$(DIST_NAME) --build-arg CLI_CODE_VERSION=$(CLI_CODE_VERSION)
+BUILD_ARGS := $(BUILD_ARGS) --build-arg DIST=$(DIST) --build-arg CLI_CODE_VERSION=$(CLI_CODE_VERSION)
 
-docker.oap: $(SW_OUT)/$(DIST_NAME).tar.gz
+docker.oap: $(SW_OUT)/$(DIST)
 docker.oap: $(SW_ROOT)/docker/oap/Dockerfile.oap
 docker.oap: $(SW_ROOT)/docker/oap/docker-entrypoint.sh
 docker.oap: $(SW_ROOT)/docker/oap/log4j2.xml
 		$(DOCKER_RULE)
 
-docker.ui: $(SW_OUT)/apache-skywalking-apm-bin.tar.gz
+docker.ui: $(SW_OUT)/$(DIST)
 docker.ui: $(SW_ROOT)/docker/ui/Dockerfile.ui
 docker.ui: $(SW_ROOT)/docker/ui/docker-entrypoint.sh
 docker.ui: $(SW_ROOT)/docker/ui/logback.xml
diff --git a/docker/oap/Dockerfile.oap b/docker/oap/Dockerfile.oap
index 016fe0a..a0a6830 100644
--- a/docker/oap/Dockerfile.oap
+++ b/docker/oap/Dockerfile.oap
@@ -87,33 +87,34 @@ RUN set -eux; \
 	done; \
 	[ -n "$success" ]; \
 	\
-	gpg --batch --verify ${SKYWALKING_CLI_ASC}; \
+	gpg --batch --verify ${SKYWALKING_CLI_ASC} ${SKYWALKING_CLI_TGZ}; \
 	tar -xvf ${SKYWALKING_CLI_TGZ}; \
-    mkdir "${SKYWALKING_HOME}/bin/"; \
-	mv skywalking-cli-${SKYWALKING_CLI_VERSION}-bin/bin/swctl-${SKYWALKING_CLI_VERSION}-linux-amd64 ${SKYWALKING_HOME}/bin/swctl; \
-	chmod 755 ${SKYWALKING_HOME}/bin/*; \
+    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 ${SKYWALKING_HOME};
+	ls -la .;
 
 FROM $BASE_IMAGE
 
+RUN apk add --no-cache openssl bash
+
 WORKDIR /skywalking
 
 ENV JAVA_OPTS=" -Xms2G "
 
-ARG DIST_NAME
+ARG DIST
 
-COPY "$DIST_NAME.tar.gz" /
+COPY "$DIST" .
 
 RUN set -ex; \
-    tar -xzf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME/config/log4j2.xml"; \
-    rm -rf "$DIST_NAME/bin"; \
-    rm -rf "$DIST_NAME/webapp"; \
-    rm -rf "$DIST_NAME/agent"; \
-    mkdir "$DIST_NAME/bin"; \
-    mv "$DIST_NAME" skywalking;
+    tar -xzf "$DIST" --strip 1; \
+    rm -rf "$DIST"; \
+    rm -rf "config/log4j2.xml"; \
+    rm -rf "bin"; \
+    rm -rf "webapp"; \
+    rm -rf "agent"; \
+    mkdir "bin";
 
 COPY --from=cli /skywalking/bin/swctl ./bin
 
diff --git a/docker/ui/Dockerfile.ui b/docker/ui/Dockerfile.ui
index d2f9f54..0ae336a 100644
--- a/docker/ui/Dockerfile.ui
+++ b/docker/ui/Dockerfile.ui
@@ -14,27 +14,28 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM adoptopenjdk/openjdk11:alpine
+FROM adoptopenjdk/openjdk11:alpine-jre
 
-ENV DIST_NAME=apache-skywalking-apm-bin \
-    JAVA_OPTS=" -Xms256M " \
+ENV JAVA_OPTS=" -Xms256M " \
     SW_OAP_ADDRESS="http://127.0.0.1:12800"
 
-COPY "$DIST_NAME.tar.gz" /
+WORKDIR skywalking
+
+ARG DIST
+COPY "$DIST" .
 
 RUN set -ex; \
     apk add bash; \
-    tar -xzf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME/config"; \
-    rm -rf "$DIST_NAME/bin"; rm -rf "$DIST_NAME/oap-libs"; rm -rf "$DIST_NAME/agent"; \
-    mv "$DIST_NAME" skywalking;
-
-WORKDIR skywalking
+    tar -xzf "$DIST" --strip 1; \
+    rm -rf "$DIST"; \
+    rm -rf "config"; \
+    rm -rf "bin"; \
+    rm -rf "oap-libs"; \
+    rm -rf "agent";
 
 COPY docker-entrypoint.sh .
 COPY logback.xml webapp/
 
 EXPOSE 8080
 
-ENTRYPOINT ["bash", "docker-entrypoint.sh"]
\ No newline at end of file
+ENTRYPOINT ["bash", "docker-entrypoint.sh"]
diff --git a/docs/en/guides/How-to-release.md b/docs/en/guides/How-to-release.md
index a6edadc..6f41294 100644
--- a/docs/en/guides/How-to-release.md
+++ b/docs/en/guides/How-to-release.md
@@ -92,7 +92,7 @@ if you haven't done it before.
     * Package name: `apache-skywalking-x.y.z-src.tar.gz`
     * See Section "Build and sign the source code package" for more details 
 1. Upload the distribution package to the folder with files ending with `.asc` and `.sha512`.
-    * Package name:  `apache-skywalking-bin-x.y.z.tar.gz` and `apache-skywalking-bin-x.y.z.zip`
+    * Package name:  `apache-skywalking-bin-x.y.z.tar.gz`.
     * See Section "Locate and download the distribution package in Apache Nexus Staging repositories" for more details.
     * Create a `.sha512` package: `shasum -a 512 file > file.sha512`
 
@@ -282,6 +282,22 @@ SkyWalking Resources:
 - Apache SkyWalking Team
 ```
 
+## Publish the Docker images
+
+```shell
+export SW_VERSION=x.y.z
+git clone --depth 1 --branch v$SW_VERSION https://github.com/apache/skywalking.git
+cd skywalking
+
+svn co https://dist.apache.org/repos/dist/release/skywalking/$SW_VERSION release
+
+export SW_OUT=release
+export HUB=apache
+export TAG=$SW_VERSION
+export DIST=<the binary package name in (1), e.g. apache-skywalking-apm-8.8.0.tar.gz>
+make docker.all && make docker.push
+```
+
 ## Clean up the old releases
 Once the latest release has been published, you should clean up the old releases from the mirror system.
 1. Update the download links (source, dist, asc, and sha512) on the website to the archive repo (https://archive.apache.org/dist/skywalking).