I have a small application that uses playwright to scrape data from various websites.
The application is Dockerized well and everything worked perfectly until I tried to re-build the Docker image (nothing really changed in the code) and it failed to install the playwright deps (like it used to before).
This is the Dockerfile:
FROM python:3.9-slim
COPY ../../requirements/dev.txt ./
RUN python3 -m ensurepip
RUN pip install -r dev.txt
RUN playwright install
RUN playwright install-deps
ENV PYTHONPATH "${PYTHONPATH}:/app/"
WORKDIR /code/src
EXPOSE 8000
COPY ./src /app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
This is the requirements:
fastapi>=0.85.0
uvicorn>=0.18.3
bs4==0.0.1
playwright
This is the error message:
=> ERROR [6/8] RUN playwright install-deps 4.1s
------
> [6/8] RUN playwright install-deps:
#10 0.762 BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
#10 0.762 Installing dependencies...
#10 1.084 Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
#10 1.269 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
#10 1.338 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#10 1.407 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
#10 2.278 Get:5 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [24.2 kB]
#10 3.063 Fetched 9176 kB in 2s (4021 kB/s)
#10 3.063 Reading package lists...
#10 3.474 Reading package lists...
#10 3.868 Building dependency tree...
#10 3.969 Reading state information...
#10 3.972 Package ttf-ubuntu-font-family is not available, but is referred to by another package.
#10 3.972 This may mean that the package is missing, has been obsoleted, or
#10 3.972 is only available from another source
#10 3.972
#10 3.972 Package libjpeg-turbo8 is not available, but is referred to by another package.
#10 3.972 This may mean that the package is missing, has been obsoleted, or
#10 3.972 is only available from another source
#10 3.972
#10 3.972 Package ttf-unifont is not available, but is referred to by another package.
#10 3.972 This may mean that the package is missing, has been obsoleted, or
#10 3.972 is only available from another source
#10 3.972 However the following packages replace it:
#10 3.972 fonts-unifont
#10 3.972
#10 3.972 Package xfonts-cyrillic is not available, but is referred to by another package.
#10 3.972 This may mean that the package is missing, has been obsoleted, or
#10 3.972 is only available from another source
#10 3.972
#10 3.974 E: Package 'ttf-unifont' has no installation candidate
#10 3.974 E: Package 'xfonts-cyrillic' has no installation candidate
#10 3.974 E: Package 'ttf-ubuntu-font-family' has no installation candidate
#10 3.974 E: Unable to locate package libx264-155
#10 3.974 E: Unable to locate package libenchant1c2a
#10 3.974 E: Unable to locate package libicu66
#10 3.974 E: Package 'libjpeg-turbo8' has no installation candidate
#10 3.974 E: Unable to locate package libvpx6
#10 3.974 E: Unable to locate package libwebp6
#10 3.975 Failed to install browser dependencies
#10 3.975 Error: Installation process exited with code: 100
------
executor failed running [/bin/sh -c playwright install-deps]: exit code: 1
The command I’m running is ‘docker-compose build’.
Hope someone could help, Thanks.
2
Answers
Solution: I changed the base image to a newer version and now it is working correctly.
I’m having the exact same issue this morning – I wonder what changed?
Your solution fixed it though! Thank you!
(I know I should post this as a comment but I dont have the rep – and frankly I don’t care)