You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/04/06 13:52:50 UTC

[skywalking] branch master updated: Add Dockerfile and build script for Java agent Docker image (#6686)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8d7d865  Add Dockerfile and build script for Java agent Docker image (#6686)
8d7d865 is described below

commit 8d7d8650dae553c1aa314ac354dd17042bba869b
Author: Zhenxu Ke <ke...@apache.org>
AuthorDate: Tue Apr 6 21:52:31 2021 +0800

    Add Dockerfile and build script for Java agent Docker image (#6686)
---
 CHANGES.md                    |  1 +
 Makefile                      |  6 +++++-
 docker/agent/Dockerfile.agent | 46 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 4e41fc7..0341457 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -9,6 +9,7 @@ Release Notes.
 * Update frontend-maven-plugin to 1.11.0, for Download node x64 binary on Apple Silicon.
 * Add E2E test for VM monitoring that metrics from Prometheus node-exporter.
 * Upgrade lombok to 1.18.16.
+* Add Java agent Dockerfile to build Docker image for Java agent.
 
 #### Java Agent
 * Remove invalid mysql configuration in agent.config.
diff --git a/Makefile b/Makefile
index 69bff7e..4ec2a1e 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ ES_VERSION?=es6
 
 docker: init build.all docker.all
 
-DOCKER_TARGETS:=docker.oap docker.ui
+DOCKER_TARGETS:=docker.oap docker.ui docker.agent
 
 docker.all: $(DOCKER_TARGETS)
 
@@ -81,6 +81,10 @@ docker.ui: $(SW_ROOT)/docker/ui/docker-entrypoint.sh
 docker.ui: $(SW_ROOT)/docker/ui/logback.xml
 		$(DOCKER_RULE)
 
+docker.agent: $(SW_OUT)/apache-skywalking-apm-bin.tar.gz
+docker.agent: $(SW_ROOT)/docker/agent/Dockerfile.agent
+		$(DOCKER_RULE)
+
 
 # $@ is the name of the target
 # $^ the name of the dependencies for the target
diff --git a/docker/agent/Dockerfile.agent b/docker/agent/Dockerfile.agent
new file mode 100644
index 0000000..a3049c3
--- /dev/null
+++ b/docker/agent/Dockerfile.agent
@@ -0,0 +1,46 @@
+# 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.
+
+ARG BASE_IMAGE='adoptopenjdk/openjdk8:alpine'
+
+FROM alpine as build
+
+ENV DIST_NAME=apache-skywalking-apm-bin
+
+ADD "$DIST_NAME.tar.gz" /
+
+RUN mv /$DIST_NAME /skywalking
+
+FROM alpine AS cli
+
+WORKDIR /skywalking/bin
+
+ARG CLI_VERSION=0.6.0
+
+ADD https://archive.apache.org/dist/skywalking/cli/${CLI_VERSION}/skywalking-cli-${CLI_VERSION}-bin.tgz /
+RUN tar -zxf /skywalking-cli-${CLI_VERSION}-bin.tgz -C / ; \
+    mv /skywalking-cli-${CLI_VERSION}-bin/bin/swctl-${CLI_VERSION}-linux-amd64 /skywalking/bin/swctl
+
+FROM $BASE_IMAGE
+
+LABEL maintainer="kezhenxu94@apache.org"
+
+ENV JAVA_TOOL_OPTIONS=-javaagent:/skywalking/agent/skywalking-agent.jar
+
+WORKDIR /skywalking
+
+COPY --from=build /skywalking/agent /skywalking/agent
+COPY --from=cli /skywalking/bin/swctl /skywalking/bin