-
Notifications
You must be signed in to change notification settings - Fork 53
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
Feature/m1 docker build support #376
Conversation
I tried this approach and reached the same conclusion, unfortunately it doesn't work this way; the zilla built with zpm on one distro can't be executed on the other. I don't have a deep enough understanding to give a detailed explanation, but I think it has to do with the fact that the files/libraries required to run java are laid out differently on Ubuntu vs Alpine (even when using the same java distro/version). |
example of multi OS build management: https://github.com/emqx/emqx-builder |
f32114a
to
d2df9b3
Compare
After looking into how other repos manage this, I believe the solution is to publish a multi-platform image as the base image tagged with the semver [x.x.x]. This would mean using the base images from this PR Then users who want to use the Implementing that would mean keeping both versions of docker files in this PR and specifying one as the default image and one as the alpine image. Then when building the default image, we would specify both platforms @jfallows @attilakreiner what do you think? |
This may also help if we decide to perform release of different platform docker images via GitHub Actions workflows. |
- separate jammy and alpine - add zilla version as env var - add the docker platform to properties - don't need to use alpine for build
d2df9b3
to
d8dd58b
Compare
separate alpine base image from the default image and add more tagging options
arm support for alpine discussion: adoptium/containers#158 |
Attempted the suggested alternate image bellsoft/liberica-openjdk-alpine-musl:20 and ran into a module not found error: Looking at how adoptium builds their alpine images, they use their own java binaries and don't have an |
4bf7f95
to
d8dd58b
Compare
@jfallows I think this PR is ready for review, but the builds are failing. I am not sure what to look for since the build works locally. Please advise. Also my maven skills are pretty rusty so I think there is something missing her to make sure both |
The docker-maven-plugin docs specify the need to create a multi-platform buildx builder named
local build and deploy to personal docker hub worked as intended: https://hub.docker.com/repository/docker/vordimous/zilla/tags?page=1&ordering=last_updated
|
cloud/docker-image/src/main/docker/release-alpine/zpm.json.template
Outdated
Show resolved
Hide resolved
* feature/m1-docker-build-support - separate jammy and alpine - add zilla version as env var - add the docker platform to properties - don't need to use alpine for build * docker image tagging options separate alpine base image from the default image and add more tagging options * set the version env var in the alpine build * remove the suffix for local build * make version tagging more explicit for each profile * move the alpine specific builds into the docker-image module * reduce the folder complexity and add child pom placeholders * revert the docker-image pom to develop * Use buildx for multi-arch images, build alpine image for release only * Move inline assembly to descriptor file and reference from alpine image --------- Co-authored-by: John Fallows <john.r.fallows@gmail.com>
Description
The primary issue I found was the
eclipse-temurin:20-alpine
issue only shows support for theamd64
platform.These changes are meant to improve the usability and cross-platform support for the zilla docker images.
The cross-platform changes are based on the maven plugin docs to add a property for the supported platforms. I replaced the alpine build image for the
eclipse-temurin:20
based onubuntu:jammy
a more suited build environment. The build image doesn't need to be as lean and is best to match the build purpose. This made building on both platforms able to use the same dockerfile. It isn't an industry standard to require apline images for all stages when using multistage builds.command when running a build on an M1 architecture:
./mvnw -DskipTests clean install -Ddocker.platforms=linux/arm64
I included some metadata I have seen to be best practice. For now, a maintainer label and version env var following the nginx image template. There are other recommended labels, but I didn't want to add too much.
The remaining challenge is when the alpine image copies the necessary binaries, they are not able to be found but the running container. I am not sure if it is an Ubuntu -> Alpine issue or a user ownership issue. If the base image for the app container is
ubuntu:jammy
, matching the build image, everything works as expected when both build and app images are alpine versions.Fixes # (issue)