wtsi-npg / samtools_container

Scripts to create a docker container for samtools
1 stars 7 forks source link

Image needs a multi-stage build #3

Closed kjsanger closed 6 months ago

kjsanger commented 8 months ago

The resulting image is very large (~ 1GB) because it still contains the C compilers and build tools. After building you should copy the build artefacts to a new image (multi-stage build) which will drop all the build tools and bring the size down considerably (probably to < 250 MB).

There are additional tricks, like cleaning the apt package cache, but a basic multi-stage should give the largest improvement. See e.g. https://github.com/wtsi-npg/npg-irods-python/blob/devel/Dockerfile

kjsanger commented 8 months ago

Also, in the final stage, the runtime version of the deb packages should be installed, rather than the -dev version.

kjsanger commented 6 months ago

Resolved by #7