Skip to content

klaki892/DockerHub-MultiArch-JavaExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java HelloWorld in Docker Hub w/ Multi-Arch Support

This is a test project to have Docker Hub use Automated builds to deploy both a amd64 and arm32v7 image of a minimal hello-world.

How it works: Docker Hub uses x86_64 machines for all build procedures, inhibiting native compilation of other architectures. By using QEMU in special Dockerfiles meant for other architecture builds and also using manifest-tools to stitch together all of the architecture builds under one release. We can have multiple architecture support just like the official Docker Hub Images.

##How to Replicate

  1. Setup Docker Hub with automated builds on push of tags:

    ####Docker Hub Autobuild Settings

    Source Type Source Docker Tag Dockerfile Location Build Context Autobuild
    Tag /^[0-9.]+/ {sourceref}-amd64 amd64.dockerfile / True
    Tag /^[0-9.]+/ {sourceref}-arm32v7 arm32v7.dockerfile / True
  2. a pre_build hook will install qemu support docker run --rm --privileged multiarch/qemu-user-static:register --reset

  3. a post_push hook will use manifest-tools to generate a collective manifest.

  4. Push a release tag to the github repo (e.g. 1.1)

Resources / Credits:

#Caveats:

  • Currently you cannot clone the repo on an ARM device and build with either dockerfile due to incompatible base images.
  • AdoptOpenJDK images will not work with QEMU / building on amd64. But OpenJDK comes to the rescue with the support. Differences in their underlying images create this difference.