Can we reduce the size of the Docker image?

Hi,

Having only delved into Joplin last week I'm loving it, I've never enjoyed writing but for whatever reason it helps me to concentrate and flow through it. So, thank you :grin:

I pulled the repo with an aim of contributing to the clients or server and fired up the Docker image first. The resultant image size came to 2228MB :scream:

With that in mind, I was hoping that you'd welcome a contribution with an aim of reducing that size and hopefully speeding up the build. There's a couple of places that I think it could make better of the cache and I'd be delighted to contribute if that was OK. I'll give you a couple of examples of where I think it could be improved:

FROM node:12

The base image for this image is a full Ubuntu installation and I suspect that it's filled with lots of unnecessary binaries. I'd be thinking of replacing the base node image with the likes of

COPY --chown=$user:$user packages/fork-sax/package*.json ./packages/fork-sax/
COPY --chown=$user:$user packages/renderer/package*.json ./packages/renderer/
COPY --chown=$user:$user packages/tools/package*.json ./packages/tools/
COPY --chown=$user:$user packages/lib/package*.json ./packages/lib/
COPY --chown=$user:$user lerna.json .
COPY --chown=$user:$user tsconfig.json .

There are a lot of COPY statements and each one creates a new layer: Best practices for writing Dockerfiles | Docker Documentation

I'd hope there was some creative way of one or two lining that, coupled with a .dockerignore it should be possible.

Let me know your thoughts.

Thanks.

LDuncAndroid

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.