Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install playwright browsers as user #317

Merged
merged 2 commits into from Apr 13, 2024
Merged

Conversation

jmtatsch
Copy link
Contributor

@jmtatsch jmtatsch commented Apr 3, 2024

fixes #297

install playwright browsers as user
@ARajgor
Copy link
Collaborator

ARajgor commented Apr 3, 2024

have you tested it perfectly? is it working

@jmtatsch
Copy link
Contributor Author

jmtatsch commented Apr 4, 2024

Yes, i have built the container numerous times - with this fix in it just builds flawlessly.
Web search also works.

@KenAijmNight
Copy link

Shouldn't it be playwright install --with-deps because it also in the README?

install chromium deps only as root
then install chromium as user
saves image size & download time
@jmtatsch
Copy link
Contributor Author

jmtatsch commented Apr 4, 2024

playwright install --with-deps installs both deps and all browsers but requires root privileges.
As we create a nonroot user in the container that user doesn't have the installed browser naturally on its path.
so we either need to change the PATH or install the browser as user.

@yassine017
Copy link

I got this while trying to run the command : playwright install --with-deps

BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
Installing dependencies...
Hit:1 https://brave-browser-apt-nightly.s3.brave.com stable InRelease
Hit:2 https://brave-browser-apt-release.s3.brave.com stable InRelease
Hit:3 http://http.kali.org/kali kali-rolling InRelease
Hit:4 https://repo.protonvpn.com/debian stable InRelease
Hit:5 https://packages.microsoft.com/debian/12/prod bookworm InRelease
Hit:6 https://packages.microsoft.com/repos/code stable InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libfontconfig1' instead of 'libfontconfig'
Package ttf-ubuntu-font-family is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libicu66 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package ttf-unifont is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
fonts-unifont

Package libjpeg-turbo8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ttf-unifont' has no installation candidate
E: Package 'ttf-ubuntu-font-family' has no installation candidate
E: Unable to locate package libx264-155
E: Unable to locate package libenchant1c2a
E: Package 'libicu66' has no installation candidate
E: Package 'libjpeg-turbo8' has no installation candidate
E: Unable to locate package libvpx6
E: Unable to locate package libwebp6
Failed to install browsers
Error: Installation process exited with code: 100

@jmtatsch
Copy link
Contributor Author

jmtatsch commented Apr 7, 2024

@yassine017 I just rebuilt the images from scratch and couldn't reproduce your issue
I built like this docker compose build --progress=plain --no-cache
how exactly are you building your image?

nevertheless there seem to be some issues installing playwright on non ubuntu systems microsoft/playwright#13530
we could either switch to a ubuntu base image ubuntu:latest or add some more sources for the font packages
RUN echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list

@ARajgor
Copy link
Collaborator

ARajgor commented Apr 12, 2024

Is it ready to merge?

@jmtatsch
Copy link
Contributor Author

imho yes

@ARajgor ARajgor merged commit b498160 into stitionai:main Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

playwright in Docker cant launch chrome
4 participants