Optimise Docker image
dragarcia opened this issue · comments
At the moment, we are building the Docker image differently from the cloud images via a Dockerfile. This is starting to be a hassle to update separately every time. Also, the compressed size of the latest image is 723.42 MB , which is getting out of hand. Downloaded image stands at 1.76 GB.
Attempt the following :
- Build the image through Ansible and make use of existing task files.
- Reduce and minimise final image size. (somewhat)
- Remove packages that are only used for building.
- Make sure downloaded files are also cleaned up at the end.
Build the image through Ansible and make use of existing task files.
Was able to achieve this and produce a working docker image. This definitely simplifies and streamlines the Docker image building process with the rest. Wiki has been updated.
Reduce and minimise final image size.
The size of the new image stands at 1.8 GB uncompressed, but now at 675.92 MB compressed. Actually increased in size for the uncompressed version but decreased for the compressed one. One thing to note is that all changes are now found in a single layer as opposed to multiple ones. For subsequent rounds of size optimization, the builds of the following images should be focused on:
- PostGIS
- pljava
- plv8
Also attempted to use the alpine version of PostgreSQL. However, this version does not have apt
installed. This forces us to write new tasks specifically to not use apt
and therefore defeats the purpose of streamlining in the first place.