rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Document step-by-step procedure for creating docker images and publishing them as part of release

Open abrokenjester opened this issue 2 years ago • 6 comments

The process to create docker images for different architectures and to publish them to dockerhub as part of the release process is poorly documented. As a result we tend to forget to do this.

  • [ ] the build script in src/main/dist/docker currently fails
  • [ ] there are no clear instructions on how to build images for both amd and arm architectures
  • [ ] there are no clear instructions on how to set both version tag and 'latest' tag and publish the images to dockerhub
  • [ ] there should be a reminder as part of the release process/script somewhere to take care of this

abrokenjester avatar Apr 03 '22 03:04 abrokenjester

Yeah, I'll have to update and improve the outdated docs on https://rdf4j.org/documentation/developer/releases/#optional-publishing-docker-images

barthanssens avatar Apr 03 '22 10:04 barthanssens

Oh, I hadn't even seen that! I was looking at the Readme.dev in assembly/src/dist/docker. We should perhaps remove that or at least link them.

abrokenjester avatar Apr 03 '22 19:04 abrokenjester

Hmz yes, some cleanup is needed :-) And perhaps having (another) look at the procedure since support for multiple platforms is easier / more common than it used to be

barthanssens avatar Apr 04 '22 08:04 barthanssens

Modern approach to do multi-arch builds: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide and https://www.docker.com/blog/multi-platform-docker-builds/

barthanssens avatar Apr 26 '22 11:04 barthanssens

So instead of manually creating separate tags per architecture, this can "now" (well, since quite a while) be handled automatically by docker / hub.docker itself.

So one can just go to the directory containing the Dockerfile and do

docker buildx build --platform=linux/amd64,linux/arm64 .

This requires that the base image being used is available for these platforms, but for RDF4J this should not be a problem (basic tomcat image is available for amd64 and arm64)

What also can be handled in 1 single Dockerfile (instead of requiring a shell script) is building the project in a "first stage" (either do a complete build via mvn, or just download the zip from the rdf4j website) , then copying the result to the second stage using COPY --from

barthanssens avatar Apr 26 '22 11:04 barthanssens

For automation, this action might be useful: https://github.com/docker/build-push-action

barthanssens avatar Aug 09 '22 08:08 barthanssens

I think this one can be closed, see also #4243

barthanssens avatar Dec 21 '22 16:12 barthanssens