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

panjuan 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 d24cd1602e0 Build multi-arch ShardingSphere-Proxy image by Docker 
Buildx (#16874)
d24cd1602e0 is described below

commit d24cd1602e0b9f5fe109fd92228f26987620d20d
Author: 吴伟杰 <[email protected]>
AuthorDate: Sat Apr 16 16:06:11 2022 +0800

    Build multi-arch ShardingSphere-Proxy image by Docker Buildx (#16874)
---
 .github/workflows/docker-per-commit.yaml           |  8 +-
 .../shardingsphere-proxy-distribution/pom.xml      | 99 ++++++++++++++++++++++
 2 files changed, 104 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/docker-per-commit.yaml 
b/.github/workflows/docker-per-commit.yaml
index eadd760e0eb..deefe66daae 100644
--- a/.github/workflows/docker-per-commit.yaml
+++ b/.github/workflows/docker-per-commit.yaml
@@ -61,7 +61,9 @@ jobs:
           registry: ${{ env.HUB }}
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
-      - name: Build docker image
-        run: ./mvnw -B -Prelease,docker -DskipTests -Dmaven.javadoc.skip=true 
-Dcheckstyle.skip=true -Drat.skip=true -Dproxy.image.repository=${{ env.PROXY 
}} -Dproxy.image.tag=${{ github.sha }} clean install
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v1
       - name: Push docker image
-        run: docker push ${{ env.PROXY }}:${{ github.sha }}
+        run: ./mvnw -am -pl 
shardingsphere-distribution/shardingsphere-proxy-distribution -B 
-Prelease,docker.buildx.push -DskipTests -Dmaven.javadoc.skip=true 
-Dcheckstyle.skip=true -Drat.skip=true -Dproxy.image.repository=${{ env.PROXY 
}} -Dproxy.image.tag=${{ github.sha }} clean install
diff --git 
a/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml 
b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
index 1c790888ee2..8fffecb45ce 100644
--- a/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
+++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/pom.xml
@@ -113,5 +113,104 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>docker.buildx.push</id>
+            <properties>
+                
<proxy.image.platform>linux/amd64,linux/arm64</proxy.image.platform>
+                
<proxy.image.repository>apache/shardingsphere-proxy</proxy.image.repository>
+                <proxy.image.tag>${project.version}</proxy.image.tag>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>3.0.0</version>
+                        <executions>
+                            <execution>
+                                <id>create builder</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>docker</executable>
+                                    <arguments>
+                                        <argument>buildx</argument>
+                                        <argument>create</argument>
+                                        <argument>--use</argument>
+                                        <argument>--driver</argument>
+                                        <argument>docker-container</argument>
+                                        <argument>--name</argument>
+                                        
<argument>shardingsphere-builder</argument>
+                                        <argument>--platform</argument>
+                                        
<argument>${proxy.image.platform}</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>build</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>docker</executable>
+                                    <arguments>
+                                        <argument>buildx</argument>
+                                        <argument>build</argument>
+                                        <argument>--pull</argument>
+                                        <argument>--platform</argument>
+                                        
<argument>${proxy.image.platform}</argument>
+                                        <argument>--build-arg</argument>
+                                        
<argument>APP_NAME=${project.build.finalName}-shardingsphere-proxy-bin</argument>
+                                        <argument>.</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>push</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>docker</executable>
+                                    <arguments>
+                                        <argument>buildx</argument>
+                                        <argument>build</argument>
+                                        <argument>--push</argument>
+                                        <argument>--platform</argument>
+                                        
<argument>${proxy.image.platform}</argument>
+                                        <argument>--build-arg</argument>
+                                        
<argument>APP_NAME=${project.build.finalName}-shardingsphere-proxy-bin</argument>
+                                        <argument>.</argument>
+                                        <argument>-t</argument>
+                                        
<argument>${proxy.image.repository}:${proxy.image.tag}</argument>
+                                        <argument>-t</argument>
+                                        
<argument>${proxy.image.repository}:latest</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>cleanup builder</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>docker</executable>
+                                    <arguments>
+                                        <argument>buildx</argument>
+                                        <argument>rm</argument>
+                                        
<argument>shardingsphere-builder</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 </project>

Reply via email to