janusgraph-docker icon indicating copy to clipboard operation
janusgraph-docker copied to clipboard

Shrink Docker image sizes via OpenJDK 8 JRE 'slim' base images

Open mbrukman opened this issue 6 years ago • 2 comments

The currently-built JanusGraph Docker images are way too large. While recent releases are on the order of 260-270MB, the built containers are much larger.

Compare:

Version Release zip size Docker image size
0.2.2 276 MB 702 MB
0.2.3 276 MB 675 MB
0.3.1 261 MB 647 MB
0.3.2 261 MB N/A (not published yet)

It may be because the current Docker images are built using the base image openjdk:8-jdk but we don't need the JDK for running JanusGraph, that's what we need to compile it. Thus, we can simply use the JRE instead of the JDK for running it, so we can start using openjdk:8-jre.

Further, we can get rid of even more unneeded support in the base image by switching to openjdk:8-jre-slim which should be sufficient for running JanusGraph.

These image versions are listed on OpenJDK image files.

For details on these image versions, see this SO answer which breaks down the various types of OpenJDK Docker image base images.

mbrukman avatar Jun 23 '19 19:06 mbrukman

We could also switch to alpine.

farodin91 avatar Jul 05 '19 10:07 farodin91

@farodin91 — good call! Looking at all available tags, here are our OpenJDK 8 Alpine-based base image candidates:

  • openjdk:8-jre-alpine
  • openjdk:8-jre-alpine3.7
  • openjdk:8-jre-alpine3.8
  • openjdk:8-jre-alpine3.9

so we can use one of the versioned base images to create smaller images.

mbrukman avatar Jul 11 '19 03:07 mbrukman