Closed codrcodz closed 2 months ago
Hi @codrcodz,
Yes, this is an expected issue. As you've mentioned, Playwright is not supported on non-glibc based Linux distributions (including Alpine):
To work around this issue, MkDocs Exporter provides a Dockerfile that builds a compatible image based on a supported operating system (Ubuntu).
This issue from the
microsoft/playwright-python
project appears to be related.TL;DR: Since
mkdocs-exporter
relies onplaywright
and (as of 2024-06-20) it does not provide install instructions or a package for Alpine, without deep diving into what Alpine system-level dependencies are required (and if they are even available via official Alpine repos), there is no way to installmkdocs-exporter
into Alpine-based docker images. Those that attempt an install will receiveplaywright
related errors below. Unfortunately, the officalmkdocs-material
, is Alpine based at this time. So a supported theme (material) is only available tomkdocs-exporter
+mkdocs-material
users if they manually installmkdocs-material
andmkdocs-exporter
onto aplaywright
supported OS (like Debian). This issue provides a sample Dockerfile that does exactly this and works as of 2024-06-20 with the current latest versions ofmkdocs-material
,mkdocs-exporter
, and theplaywright
Pypi packages; however, it would be great ifmkdocs-exporter
developers could figure out how to allow for Alpine based installs or (at a mimimum) advertise that they do not support Alpine-based deployments.Expected Behavior
Given I attempt to install
mkdocs-exporter
into the official, latestdocker.io/squidfunk/mkdocs-material:9.5.27
(v9.5.27 at the time of this bug report) Docker container image like so,as described by the official mkdocs-material documentation for installing additional python plugin libraries,
When I execute a
docker build
command, like so,Then the Docker container image builds successfully and
mkdocs-exporter
functions as described in the documentation when using it to export mkdocs sites as PDFs.Observed Behavior
Given I attempt to install
mkdocs-exporter
into the official, latestdocker.io/squidfunk/mkdocs-material:9.5.27
(v9.5.27 at the time of this bug report) Docker container image like so,as described by the official mkdocs-material documentation for installing additional python plugin libraries,
When I execute a
docker build
command, like so,Then the Docker container image fails to build, and provides the following error messages:
Additional Notes
Running
pip --debug install mkdocs-exporter
on theRUN
line of the Dockerfile yields a more robust error message with colorized output. I have not provided that here due to the length of the output, the custom formatting that will likely get mangled, and how easily reproducible it is on a developer's local machine.I have attempted this same install procedure with downgraded versions of both the Docker container image and the
mkdocs-exporter
library, so I suspect it has been an issue for a while.I have attempted explicitly installing
playwright
viapip install playwright
inside the container and experienced similar errors.Attempting to install older versions of playwright explicitly (
playwright==1.33.0
, for example) yields the same results.The
docker.io/squidfunk/mkdocs-material:9.5.27
image uses Alpine 3.19.1, which is still supported by the Alpine team until 2025-05-09.It looks like
playwright
is not installable on the upstream vanilla Alpine image either based on this test:However, it has no issues on this Debian-based image:
I was able to get
mkdocs-exporter
working by translating the officialmkdocs-material
Dockerfile to a functionally equivalent Debian-based one, but that solution is not exactly ideal. For anyone else trying to solve this same issue in the interim, here is the Dockerfile:Note: size-wise, this is nowhere as close to as slim as the Alpine-based image provided by
squidfunk/mkdocs-material
, and I am sure there is more refinement that can be done to make it slimmer, but it works (as of v9.5.27 of mkdocs-material). Here is the original Dockerfile that this one is based on. This Dockerfile assumes that you have done agit clone
ofsquidfunk/mkdocs-material
from Github and that repository is in a subdirectory relative to this Dockerfile.The biggest differences between this Dockerfile and the official one from mkdocs-material are:
apt
is used instead ofapk
for system pkg installstini
is installed in a different directory so the ENTRYPOINT is differentuser-requirements.txt
install lines and hardcoded the install of libraries likemkdocs-exporter