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

rombert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter.git

commit 1b879e7eec280e1bd20a4bc1e247f29604f26294
Author: Tomasz Michalak <[email protected]>
AuthorDate: Fri Nov 25 13:31:51 2022 +0100

    SLING-11714 Multi-arch support for Docker images
---
 .github/workflows/docker-push.yml | 60 +++++++++++++++++++++++++++++++++++
 README.md                         | 16 ++++++----
 RELEASING.md                      | 14 ++++++++
 pom.xml                           | 67 ++++++++++++++++++++++++++++-----------
 4 files changed, 132 insertions(+), 25 deletions(-)

diff --git a/.github/workflows/docker-push.yml 
b/.github/workflows/docker-push.yml
new file mode 100644
index 0000000..25fcf73
--- /dev/null
+++ b/.github/workflows/docker-push.yml
@@ -0,0 +1,60 @@
+# 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: Push Sling Starter Docker images
+
+on:
+  workflow_dispatch:
+    inputs:
+      git_tag:
+        description: 'Git tag name'
+        required: true
+      image_tag:
+        description: 'Docker image tag name'
+        required: true
+
+jobs:
+  sling-starter-push-image:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          repo-token: ${{ secrets.GITHUB_TOKEN }}
+      - name: Set up JDK 17
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'adopt'
+          java-version: '17'
+          cache: 'maven'
+      - name: Login to Docker Hub
+        id: login-docker-hub
+        uses: docker/login-action@v2
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Checkout latest tag
+        run: |
+          git fetch --all
+          git fetch --tags
+          git checkout tags/${{ github.event.inputs.git_tag }}
+      - name: Set up QEMU # https://github.com/docker/buildx/issues/499
+        uses: docker/setup-qemu-action@v2
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+      - name: Push Docker image
+        run: mvn --batch-mode clean install -Ddocker.image.tag=${{ 
github.event.inputs.image_tag }} -Dmaven.test.skip=true -Ddocker.skip=false 
-Ddocker.skip.push=false
\ No newline at end of file
diff --git a/README.md b/README.md
index 2a70872..0cd4194 100644
--- a/README.md
+++ b/README.md
@@ -47,11 +47,13 @@ This expects a MongoDB server to be running, search for 
`mongodb://` in the feat
 
 The following tags are supported
 
-* `12, latest` - Apache Sling Starter 12 - ( 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter/blob/org.apache.sling.starter-12/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-12-released.html) )
-* `11` - Apache Sling Starter 11 - ( 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/11/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-11-released.html) )
-* `10` - Apache Sling Starter 10 - ( 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/10/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-10-released.html) )
-* `9`- Apache Sling Launchpad 9 - ( 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/9/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-launchpad-9-released.html) 
)
-* `snapshot` - developments builds based on the latest version on the master 
branch - ( 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter/blob/master/Dockerfile)
 )
+| Tag name       | Supported platforms | Links                                 
                                                                                
                                                                    |
+|----------------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `12`, `latest` | `amd64`             | 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter/blob/org.apache.sling.starter-12/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-12-released.html) |
+| `11`           | `amd64`             | 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/11/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-11-released.html)          
         |
+| `10`           | `amd64`             | 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/10/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-10-released.html)          
         |
+| `9`            | `amd64`             | 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter-docker/blob/9/Dockerfile),
 [Release notes](https://sling.apache.org/news/sling-launchpad-9-released.html) 
          |
+| `snapshot`     | `amd64`, `arm64`    | 
[Dockerfile](https://github.com/apache/sling-org-apache-sling-starter/blob/master/Dockerfile)
                                                                                
             |
 
 The Docker image only needs the port 8080 to be exposed
 
@@ -89,10 +91,10 @@ Additionally, when the `ci` profile is enabled the smoke 
tests are also executed
 
 ## Building the Docker image
 
-This module can optionally build a Docker image. This is achieved by running a 
build with the `-Ddocker.skip=false` argument. By default, the image is built 
as `apache/sling:snapshot`. The tag can be overrriden using the `docker.label` 
Maven property.
+This module can optionally build a Docker image. This is achieved by running a 
build with the `-Ddocker.skip=false` argument. By default, the image is built 
as `apache/sling:snapshot`. The tag can be overrriden using the 
`docker.image.tag` Maven property.
 
 ```
-$ mvn clean package -Ddocker.skip=false -Ddocker.label=local
+$ mvn clean package -Ddocker.skip=false -Ddocker.image.tag=local
 $ docker run --rm -p 8080:8080 apache/sling:local
 ```
 
diff --git a/RELEASING.md b/RELEASING.md
new file mode 100644
index 0000000..b438a15
--- /dev/null
+++ b/RELEASING.md
@@ -0,0 +1,14 @@
+# Releasing
+
+## Docker image registry
+We use DockerHub to publish our Sling Starter docker image.
+
+## Releasing version
+Once we release Sling Starter and create tag, we must prepare the Sling 
Starter docker image. We 
+use GitHub Actions to push our images to DockerHub. From the [GitHub Actions 
dashboard](https://github.com/apache/sling-org-apache-sling-starter/actions)
+we run the `Push Sling Starter Docker images` workflow specifying
+
+- `git_tag` - git tag name e.g `org.apache.sling.starter-13`
+- `image_tag` - docker image tag name e.g `13`
+
+to build and push Docker images using codebase from the specified tag.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 500d710..f108389 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,8 +57,12 @@
         <groovy.version>3.0.12</groovy.version>
         <!-- skip index generation for all builds except for CI and release -->
         <bnd.index.generation.skip>true</bnd.index.generation.skip>
+        <!-- check docker.skip in https://dmp.fabric8.io/ -->
         <docker.skip>true</docker.skip>
-        <docker.label>snapshot</docker.label>
+        <!-- check docker.skip.push in https://dmp.fabric8.io/ -->
+        <docker.skip.push>true</docker.skip.push>
+        <docker.image.name>apache/sling</docker.image.name>
+        <docker.image.tag>snapshot</docker.image.tag>
         <mongo.container.image>mongo:4.4.6</mongo.container.image>
         <it.startTimeoutSeconds>60</it.startTimeoutSeconds>
         <!-- used for reproducible builds 
(https://maven.apache.org/guides/mini/guide-reproducible-builds.htm), 
automatically updated during release -->
@@ -261,25 +265,10 @@
             <plugin>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
-                <version>0.39.0</version>
+                <version>0.40.3</version>
                 <configuration>
                     <skip>${docker.skip}</skip>
                     <containerNamePattern>%e</containerNamePattern>
-                    <images>
-                        <image>
-                            <alias>mongo</alias>
-                            <name>${mongo.container.image}</name>
-                            <run>
-                                <ports>
-                                    <port>${mongo.port}:27017</port>
-                                </ports>
-                                <wait>
-                                    <log>CONTROL</log>
-                                    <time>60000</time>
-                                </wait>
-                            </run>
-                        </image>
-                    </images>
                     <stopMode>kill</stopMode>
                 </configuration>
                 <executions>
@@ -290,6 +279,23 @@
                         <goals>
                             <goal>start</goal>
                         </goals>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <alias>mongo</alias>
+                                    <name>${mongo.container.image}</name>
+                                    <run>
+                                        <ports>
+                                            <port>${mongo.port}:27017</port>
+                                        </ports>
+                                        <wait>
+                                            <log>CONTROL</log>
+                                            <time>60000</time>
+                                        </wait>
+                                    </run>
+                                </image>
+                            </images>
+                        </configuration>
                     </execution>
                     <execution>
                         <id>stop-mongo</id>
@@ -298,19 +304,44 @@
                         <goals>
                             <goal>stop</goal>
                         </goals>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <alias>mongo</alias>
+                                    <name>${mongo.container.image}</name>
+                                    <run>
+                                        <ports>
+                                            <port>${mongo.port}:27017</port>
+                                        </ports>
+                                        <wait>
+                                            <log>CONTROL</log>
+                                            <time>60000</time>
+                                        </wait>
+                                    </run>
+                                </image>
+                            </images>
+                        </configuration>
                     </execution>
                     <execution>
                         <id>build-docker-image</id>
                         <phase>package</phase>
                         <goals>
                             <goal>build</goal>
+                            <!-- -D docker.skip.push=false -->
+                            <goal>push</goal>
                         </goals>
                         <configuration>
                             <!-- Configure the sling image only for build, we 
don't want to run it  -->
                             <images>
                                 <image>
-                                    <name>apache/sling:${docker.label}</name>
+                                    
<name>${docker.image.name}:${docker.image.tag}</name>
                                     <build>
+                                        <buildx>
+                                            <platforms>
+                                                
<platform>linux/amd64</platform>
+                                                
<platform>linux/arm64</platform>
+                                            </platforms>
+                                        </buildx>
                                         <dockerFile>Dockerfile</dockerFile>
                                         
<contextDir>${project.basedir}</contextDir>
                                     </build>

Reply via email to