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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7f412e8  Build docker image per commit (#16070)
7f412e8 is described below

commit 7f412e8acc407c9e7145b011933ceb4e893bf405
Author: 孙念君 Sun Nianjun <[email protected]>
AuthorDate: Mon Mar 14 19:43:33 2022 +0800

    Build docker image per commit (#16070)
    
    * Add : add github action to push proxy image per commit (#16068)
    
    * Format : format the xml file
    
    * Format : format the xml file
---
 .github/workflows/docker-per-commit.yaml           | 68 ++++++++++++++++++++++
 .../shardingsphere-proxy-distribution/pom.xml      | 26 +++++++++
 2 files changed, 94 insertions(+)

diff --git a/.github/workflows/docker-per-commit.yaml 
b/.github/workflows/docker-per-commit.yaml
new file mode 100644
index 0000000..09c911b
--- /dev/null
+++ b/.github/workflows/docker-per-commit.yaml
@@ -0,0 +1,68 @@
+# 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-docker
+
+on:
+  push:
+    branches:
+      - master
+
+env:
+  SKIP_TEST: true
+  HUB: ghcr.io/apache/shardingsphere
+  PROXY: ghcr.io/apache/shardingsphere-proxy
+
+jobs:
+  build:
+    if: github.repository == 'apache/shardingsphere'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    timeout-minutes: 90
+    env:
+      TAG: ${{ github.sha }}
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - name: Cache local Maven repository
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Log in to the Container registry
+        uses: docker/[email protected]
+        with:
+          registry: ${{ env.HUB }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
+      - name: Build and push docker images based on Java 8
+        env:
+          SW_OAP_BASE_IMAGE: eclipse-temurin:8-jre
+          TAG: ${{ github.sha }}-java8
+        run: ./mvnw -B -Prelease,docker-per-commit -DskipTests 
-Dmaven.javadoc.skip=true -Drat.skip=true clean install
+      - name: retag the images
+        run: docker tag ${{ env.PROXY }}:PER_COMMIT ${{ env.PROXY }}:${{ 
github.sha }}
+      - name: Build and push docker images
+        run: docker push ${{ env.PROXY }}:${{ github.sha }}
diff --git 
a/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml 
b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
index d0c4e9b..3bbd776 100644
--- a/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
+++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
@@ -109,5 +109,31 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>docker-per-commit</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>dockerfile-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>shardingsphere-proxy-bin</id>
+                                <goals>
+                                    <goal>build</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            
<repository>ghcr.io/apache/shardingsphere-proxy</repository>
+                            <tag>PER_COMMIT</tag>
+                            <buildArgs>
+                                
<APP_NAME>${project.build.finalName}-shardingsphere-proxy-bin</APP_NAME>
+                            </buildArgs>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 </project>

Reply via email to