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/11/04 04:34:45 UTC
[skywalking-showcase] 12/12: Add workflow to publish Docker images
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-showcase.git
commit fa01b9fa0d498427a0fd03420648340cee5d59a9
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Thu Nov 4 12:34:03 2021 +0800
Add workflow to publish Docker images
---
.github/workflows/publish-images.yaml | 46 ++++++++++++++++++++++++++++++++
Makefile | 11 +++++---
services/app/Makefile | 2 +-
services/recommendation-service/Makefile | 2 +-
4 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml
new file mode 100644
index 0000000..8dbc475
--- /dev/null
+++ b/.github/workflows/publish-images.yaml
@@ -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.
+
+name: publish-images
+
+on:
+ push:
+ branches:
+ - main
+
+env:
+ HUB: ghcr.io/apache/skywalking-showcase
+
+jobs:
+ build:
+ if: github.repository == 'apache/skywalking-showcase'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Log in to the Container registry
+ uses: docker/login-action@v1.10.0
+ with:
+ registry: ${{ env.HUB }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and push Docker image
+ run: make push || make push
diff --git a/Makefile b/Makefile
index 57f5c08..7edc1f6 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ $(services):
$(MAKE) -C $@ build
.PHONY: build
-build: $(services) ## Build the services
+build: $(services) ## Build the services if needed (e.g.: compiling Java files, build Go binary), do nothing if no need (e.g.: Python)
services_docker = $(foreach svc,$(services),$(svc).docker.build)
.PHONY: docker
@@ -35,8 +35,13 @@ docker: $(services_docker) ## Build Docker images
$(services_docker): %.docker.build: %
$(MAKE) -C $< docker.build
-.PHONY: docker.build
-docker.build: $(services_docker)
+services_push = $(foreach svc,$(services),$(svc).docker.push)
+.PHONY: push
+push: $(services_push) ## Build and push Docker images
+
+.PHONY: $(services_push)
+$(services_push): %.docker.push: %
+ $(MAKE) -C $< docker.push
##@ Deploy targets
diff --git a/services/app/Makefile b/services/app/Makefile
index 2560e3d..f38b33a 100644
--- a/services/app/Makefile
+++ b/services/app/Makefile
@@ -19,7 +19,7 @@
include ../../Makefile.in
.PHONY: build
-build: docker.build
+build:
.PHONY: docker docker.build docker.push
diff --git a/services/recommendation-service/Makefile b/services/recommendation-service/Makefile
index 3395621..fff6299 100644
--- a/services/recommendation-service/Makefile
+++ b/services/recommendation-service/Makefile
@@ -19,7 +19,7 @@
include ../../Makefile.in
.PHONY: build
-build: docker.build
+build:
.PHONY: docker docker.build docker.push