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/02/20 03:58:16 UTC

[skywalking-satellite] branch polish/dockerfile updated (fa557be -> 8a6018d)

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

kezhenxu94 pushed a change to branch polish/dockerfile
in repository https://gitbox.apache.org/repos/asf/skywalking-satellite.git.


 discard fa557be  Optimize Docker image and startup script
     new 8a6018d  Optimize Docker image and startup script

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (fa557be)
            \
             N -- N -- N   refs/heads/polish/dockerfile (8a6018d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/build-and-test.yaml | 2 ++
 1 file changed, 2 insertions(+)


[skywalking-satellite] 01/01: Optimize Docker image and startup script

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8a6018d3a87f346b69c51f32cd191921eeac882f
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sat Feb 20 11:57:23 2021 +0800

    Optimize Docker image and startup script
---
 .github/workflows/build-and-test.yaml |  2 ++
 Makefile                              |  6 ++--
 docker/Dockerfile                     | 30 +++++++++-------
 docker/docker-compose.yml             | 65 +++++++++++++++++++++++++++++++++++
 docker/entrypoint.sh                  | 25 --------------
 docs/README.md                        |  2 +-
 6 files changed, 88 insertions(+), 42 deletions(-)

diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml
index bd2ddf0..c61578d 100644
--- a/.github/workflows/build-and-test.yaml
+++ b/.github/workflows/build-and-test.yaml
@@ -58,6 +58,8 @@ jobs:
         run: make test
       - name: Build
         run: make build
+      - name: Build Docker
+        run: make docker
 
   result:
     runs-on: ubuntu-latest
diff --git a/Makefile b/Makefile
index 8634797..925e5ee 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ GO_GET = $(GO) get
 GO_TEST = $(GO) test
 GO_LINT = $(GO_PATH)/bin/golangci-lint
 GO_BUILD_FLAGS = -v
-GO_BUILD_LDFLAGS = -X main.version=$(VERSION)
+GO_BUILD_LDFLAGS = -X main.version=$(VERSION) -w -s
 GQL_GEN = $(GO_PATH)/bin/gqlgen
 
 PLATFORMS := linux darwin windows
@@ -87,8 +87,8 @@ check: clean
 	fi
 
 .PHONY: docker
-docker: release-bin
-	/bin/sh tools/docker_build.sh $(VERSION)
+docker:
+	docker build --build-arg VERSION=$(VERSION) -t apache/skywalking-satellite:$(VERSION) --no-cache . -f docker/Dockerfile
 
 release-src: clean
 	-tar -zcvf $(RELEASE_SRC).tgz \
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 4a5ee4d..61344b8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -14,24 +14,28 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM busybox
+FROM golang:1.15 as build
 
-ARG DIST_NAME='skywalking-satellite-latest-bin'
-ARG HOME='/skywalking-satellite'
+ARG VERSION="latest"
 
-COPY "$DIST_NAME.tgz" /
+ENV CGO_ENABLED=0
 
-RUN set -ex; \
-    tar -xzf "$DIST_NAME.tgz"; \
-    rm -rf "$DIST_NAME.tgz"; \
-    ls "$DIST_NAME/bin" |grep -v linux-amd64| xargs -i echo "$DIST_NAME/bin/{}"|xargs rm -rf; \
-    mkdir "$HOME"; \
-    mv "$DIST_NAME"/* "$HOME";
+WORKDIR /src
 
-COPY entrypoint.sh "$HOME"/bin
+COPY . .
 
-WORKDIR /skywalking-satellite
+RUN VERSION=$VERSION make linux
+RUN mv /src/bin/skywalking-satellite-${VERSION}-linux-amd64 /src/bin/skywalking-satellite
+
+FROM scratch
+
+VOLUME /skywalking/configs
+
+WORKDIR /skywalking
+
+COPY --from=build /src/bin/skywalking-satellite /
+COPY --from=build /src/configs /skywalking/configs
 
 EXPOSE 12800 11800 1234
 
-ENTRYPOINT ["/bin/sh","bin/entrypoint.sh"]
+CMD ["/skywalking-satellite", "start", "--config", "/skywalking/configs/satellite_config.yaml"]
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..997c390
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,65 @@
+# 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.
+
+version: '3.8'
+
+services:
+  zookeeper:
+    image: zookeeper:3.4
+    hostname: zookeeper
+    expose:
+      - 2181
+    environment:
+      - ALLOW_ANONYMOUS_LOGIN=yes
+    healthcheck:
+      test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 2181"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  kafka:
+    image: bitnami/kafka:2.4.1
+    hostname: kafka
+    expose:
+      - 9092
+    environment:
+      - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
+      - KAFKA_BROKER_ID=10
+      - ALLOW_PLAINTEXT_LISTENER=yes
+    depends_on:
+      zookeeper:
+        condition: service_healthy
+    healthcheck:
+      test: ["CMD", "kafka-topics.sh", "--list", "--zookeeper", "zookeeper:2181"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  satellite:
+    build:
+      context: ..
+      dockerfile: docker/Dockerfile
+    image: apache/skywalking-satellite
+    container_name: satellite
+    expose:
+      - 1234
+      - 11800
+      - 12800
+    environment:
+      SATELLITE_KAFKA_CLIENT_BROKERS: kafka:9092
+    depends_on:
+      kafka:
+        condition: service_healthy
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
deleted file mode 100755
index ee20df0..0000000
--- a/docker/entrypoint.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-
-#
-# 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.
-#
-
-HOME_DIR="$(cd "$(dirname "$0")" && cd .. && pwd)"
-CONFIG_FILE=${HOME_DIR}/configs/satellite_config.yaml
-START_UP_PROCESS=$(find "${HOME_DIR}/bin" -name "skywalking-satellite*linux*")
-
-exec "$START_UP_PROCESS" start --config="$CONFIG_FILE"
-
diff --git a/docs/README.md b/docs/README.md
index 309f795..c319706 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -14,6 +14,6 @@ From here you can learn all about **SkyWalking Satellite's** architecture, how t
 
 - [FAQs](en/FAQ/README.md). A manifest of already known setup problems, secondary developments experiments. When you are facing a problem, check here first.
 
-We're always looking for help improving our documentation and codes, so please don’t hesitate to [file an issue](https://github.com/apache/skywalking/issues/new) 
+We're always looking for help improve our documentation and codes, so please don’t hesitate to [file an issue](https://github.com/apache/skywalking/issues/new) 
 if you see any problem. 
 Or better yet, submit your own contributions through pull request to help make them better.