Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-arch/arm64 support #672

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pushes snapshot builds to Docker Hub. Why is that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. I think that in current master, it should also push snapshots and release builds are additionally tagged with :latest.

I think the reason why this is included now within the same build command is due to buildx - it builds the container in an embedded build environment (to emulate arm64) and since it's also wrapped inside docker-maven-plugin, there is no good way to get the built image back to running environment. So buildx is asked to directly push the image.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. It also makes it easier for people that want to test with a snapshot build.
@davideicardi Do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks good to me. Do you think that we need to change something for release build?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think further changes are needed. The lines below take care of the release process and they still do what happened before: apply a tag of the release and add the latest tag.
I'm going to merge this PR.


# 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