vivliostyle / vivliostyle-cli

⚒ Supercharge command-line publication workflow.
https://docs.vivliostyle.org/#/vivliostyle-cli
GNU Affero General Public License v3.0
166 stars 25 forks source link

Reduce size of Docker image by removing Python3 etc. #314

Open MurakamiShinyu opened 2 years ago

MurakamiShinyu commented 2 years ago

Previously, we reduced the Docker image size by not installing WebKit and Firefox that are installed in the Playwright official Docker image:

However, the latest Docker image ghcr.io/vivliostyle/cli:5.2.1 size is bigger (2.25GB) because we added large fonts in the Docker image:


I tried to further reduce the image size, but without success.

I tried to use "node:16-buster-slim" as base instead of "ubuntu:focal" and nodejs install but got warning "your OS is not officially supported by Playwright" and error "E: Package 'ttf-ubuntu-font-family' has no installation candidate".

Then, I tried to uninstall python3.8 that was installed when nodejs was installed:

https://github.com/vivliostyle/vivliostyle-cli/blob/0acdd2858b7fa51d33304e621c3c129d9a808ab0/Dockerfile#L15-L16

I tried to purge all python3* packages by apt-get purge -y libpython3-stdlib libpython3.8-minimal libpython3.8-stdlib python3 python3-minimal python3.8 python3.8-minimal. The result was that it removed not only python3 but also nodejs. (nodejs depends on python3-minimal)

... I realized that removing python3 packages is not very good idea. It's less effective, the saving size will be about 24MB that is not very large compared to the current Docker image size.

MurakamiShinyu commented 1 year ago

Current vivliostyle-cli docker image size is very big because of installed fonts,

To reduce the docker image size, we might need to reconsider the installed fonts.