nevergreen icon indicating copy to clipboard operation
nevergreen copied to clipboard

Build nevergreen docker image for linux/arm64 and linux/arm/v7

Open chadlwilson opened this issue 4 years ago • 3 comments

Feature Request

What would you like to be able to do? I'd love to be able to run Nevergreen on Raspberry Pi via Docker. Although the Raspberry Pi itself is an arm64 processor, Raspbian is built for 32-bit, so only works with armv7 built Docker images.

Currently images are only built for linux/amd64.

What problem would it solve? When running in private/enterprise environments, teams often need to run Nevergreen themselves (e.g for CI servers behind VPNs or local networks). Raspberry Pi is a convenient way to do that in lieu of proper support from the team running the CI tooling, and Docker makes this relatively simple to get going with.

Additional info I'm not sure on the CircleCI build process for Nevergreen, however this Bamboo proxy project shows an example of doing so with docker buildx on GitHub actions; including automating the manifest creation and publishing to DockerHub.

chadlwilson avatar Dec 04 '19 00:12 chadlwilson

Hi @chadlwilson, thanks for raising this feature request!

I'm not going to lie, I don't really know a lot about Docker and we got a lot of help setting up the original docker build.

Things that I'm thinking about:

  • I have no access to a Raspberry Pi, how can I test this?
  • I'm worried about breaking our existing working Docker image

GentlemanHal avatar Dec 05 '19 22:12 GentlemanHal

Hi @GentlemanHal - thanks for your work on NeverGreen!

I wouldn't consider myself an expert on multi-arch builds in particular, but in my recent research it seems most take an approach via qemu emulation/virtualization, which the new docker buildx seems to go a long way toward making easier.

Same can be applied for testing I guess (some dockerfiles run a sanity test command as the final command while building the image).

I also have a couple of Raspberry Pi's for sanity checking, and can dig around and see if there is a docker buildx approach for CircleCI. Also need to check if Azul openjdk has multi-arch builds since it's the current base image.

As for breaking the existing image, I think that it's lowish risk as your image is quite simple, Java is pretty good cross-platform and the multi-arch builds are effectively different images under the same tag when using manifests. Alternatively one can use different tags for different architectures.

chadlwilson avatar Dec 06 '19 00:12 chadlwilson

After a bit more thinking, I found this not really quite as necessary as I was first thinking, since Nevergreen is also released as an executable jar which makes it pretty easy to run anywhere.

Adocker-compose.yml like the below works perfectly fine on the Pi using the adoptopenjdk base images which are already multi-architecture builds.

version: "3.7"

services:
  nevergreen:
    image: adoptopenjdk:12-hotspot
    ports:
      - 5000:5000
    volumes:
      - ./tmp:/app
    command: ['java', '-jar', '/app/nevergreen-standalone.jar']
    restart: unless-stopped

with this to download the latest version prior

mkdir -p tmp
if [[ ! -f tmp/nevergreen-standalone.jar ]]; then
  wget $( curl https://api.github.com/repos/build-canaries/nevergreen/releases/latest | grep browser_download_url | head -n 1 | cut -d '"' -f 4 )
  mv nevergreen-standalone.jar tmp/nevergreen-standalone.jar
fi

chadlwilson avatar Dec 22 '19 14:12 chadlwilson

Given you were able to solve your issue @chadlwilson and I haven't learnt anymore about Docker, I'm going to close this issue for now.

Always happy to reopen or accept pull requests if anyone things this is still valuable. I'm just realistically not going to work on this anytime soon.

GentlemanHal avatar Nov 09 '22 12:11 GentlemanHal

Yup, no worries.

chadlwilson avatar Nov 09 '22 12:11 chadlwilson