garris/BackstopJS

Why Japanese / Chinese fonts are removed in docker?

Closed this issue · 4 comments

Here is an issue that was successfully merged.

@tkrah
In one of near commits fonts are removed

So only English characters may be visible again. Bug of 2019 year is returned.

Also, container's USER was suddenly changed to node instead of root. And that completely broke compatibility. Permissions should be set from scratch. node user ID is also unknown so mounting of external volumes is not possible anymore. I spent about 8 hours to be able understand why GitHub Actions became completely broken.

tkrah commented

The user change is by intention, just run it with the right user argument and you should be fine, see DockerCommandTemplate in the readme, at least there were already positive reports for the PR which was merged yesterday. It is usually considered best practice not to run as root, so I changed that too.
I don't understand what you mean with uid is unknown, look at the upstream node image, there the node user is created and here we just use that one which the node image did create, with a known uid ... and you can always change that running with the correct user argument for your use case and if you insist on root while it is not recommended, you can even run as root.

The docker smoke test did run, so bugs may happen if there is no test for that.
Feel free to be more supportive here and tell exactly which package is now missing and create a PR to fix it instead of just ranting, maybe with a nice comment in the Dockerfile for future contributors and a test so it is not happening again.

You could also have tested the original PR for the arm64 support and leave feedback there if you are so in need of that image.
As a quick workaround just build your own image and install your missing fonts or even more easier, just stay on 6.1.4 ... Until you made your PR to fix it in the latest version.

I don't understand what you mean with uid is unknown

I mean that we have to run official node image once to know exact uid. And before of it we have to search that BackstopJS image is actually using official node one. Okay I understand services may and should be changed and improved. But that was a real pain to debug suddenly changed image inside GitHub Actions runner (that is like black box by itself).

and create a PR to fix it instead of just ranting

Sorry, I don't have much time for detailed testing. I've added full set of packages that was removed in last commit in my Dockerfile as is:

RUN apt-get -qqy update \
  && apt-get -qqy --no-install-recommends install \
    libfontconfig \
    libfreetype6 \
    xfonts-cyrillic \
    xfonts-scalable \
    fonts-liberation \
    fonts-ipafont-gothic \
    fonts-wqy-zenhei \
    libgbm-dev \
    gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget \
  && rm -rf /var/lib/apt/lists/* \
  && apt-get -qyy clean

And now fonts are working properly again. Not sure if all of these libraries are necessary.
Here is original issue. So looks like

libfontconfig
libfreetype6
xfonts-cyrillic
xfonts-scalable
fonts-liberation
fonts-ipafont-gothic
fonts-wqy-zenhei
fonts-tlwg-loma-otf
ttf-ubuntu-font-family

libraries should be installed for multi-language (non-English characters) support.

tkrah commented

@amenamenamenamen fix merged. Have a look on the next released image when it is available.

@tkrah
User is switching to root only after running first apt-get

if user of original image is not root, then first apt-get will be failed because of lack of permissions,
if user of original image is root, then USER root is not necessary at all.

So, probably RUN apt-get ... should be added after USER root