Skip to content

Commit

Permalink
Multi-arch/arm64 support (#672)
Browse files Browse the repository at this point in the history
* Switch to io.fabric8 docker plugin
* Build multi-arch Docker images
* Use maven to push multi-arch images
* Push during build stage as a workaround for buildx
* Retag the built snapshot if it is a release
* Set up buildx on GHA
  • Loading branch information
Blefish authored Nov 15, 2024
1 parent d85b388 commit 1b9f882
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,26 @@ jobs:
run: |
echo "app_ver=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)"
echo "app_ver=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Docker hub action
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Build with Maven
run: mvn -B clean integration-test package assembly:single docker:build
run: mvn -B clean integration-test package assembly:single docker:build docker:push

# github_release:
-
Expand All @@ -40,19 +57,7 @@ jobs:
commit: "master"
generateReleaseNotes: true

# Docker hub action
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: push snapshot version
run: |
echo publishing docker container $app_ver
docker push docker.io/obsidiandynamics/kafdrop:$app_ver
-
name: push latest if it's a release
if: ${{ ! endsWith( env.app_ver, '-SNAPSHOT' ) }}
run: docker push docker.io/obsidiandynamics/kafdrop:latest
run: docker buildx imagetools create docker.io/obsidiandynamics/kafdrop:$app_ver --tag docker.io/obsidiandynamics/kafdrop:latest
38 changes: 22 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<protobuf.version>3.25.5</protobuf.version>
<testcontainers.version>1.20.3</testcontainers.version>
<kafka-libs.version>7.7.1</kafka-libs.version>
<docker.platforms>linux/amd64,linux/arm64</docker.platforms>
</properties>

<scm>
Expand Down Expand Up @@ -239,24 +240,29 @@
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.2</version>
<version>0.45.0</version>
<configuration>
<imageName>obsidiandynamics/kafdrop</imageName>
<forceTags>true</forceTags>
<dockerDirectory>${project.build.directory}/docker-ready</dockerDirectory>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}-bin.tar.gz</include>
</resource>
</resources>
<images>
<image>
<name>obsidiandynamics/kafdrop:${project.version}</name>
<build>
<assemblies>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</assemblies>
<buildx>
<platforms>
<platform>${docker.platforms}</platform>
</platforms>
</buildx>
<contextDir>${project.build.directory}/docker-ready</contextDir>
<noCache>true</noCache>
</build>
</image>
</images>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM eclipse-temurin:17.0.13_11-jdk

ADD kafdrop.sh /
ADD kafdrop*tar.gz /
ADD maven/ /kafdrop/

RUN chmod +x /kafdrop.sh

Expand Down

0 comments on commit 1b9f882

Please sign in to comment.