docker: Install playwright dependencies on arm64

Also changed our code to only install chromium.

Closes #835
This commit is contained in:
Anmol Sethi 2023-02-16 19:38:02 -08:00
parent ce19b61584
commit 5c2a80330f
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
2 changed files with 8 additions and 5 deletions

View file

@ -7,9 +7,9 @@ RUN apt-get update && apt-get install -y ca-certificates curl dumb-init sudo
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -s - && \
apt-get install -y nodejs
# https://github.com/microsoft/playwright/issues/18319
# Hopefully soon.
RUN if [ "$TARGETARCH" = amd64 ]; then npx playwright install-deps; fi
# @next until 1.31 for arm64 debian support.
# See https://github.com/microsoft/playwright/issues/18319
RUN npx playwright@next install-deps chromium
RUN adduser --gecos '' --disabled-password debian \
&& echo "debian ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
@ -28,7 +28,7 @@ RUN mkdir -p /usr/local/lib/d2 \
&& rm -Rf /tmp/d2-*-linux-"$TARGETARCH".tar.gz
USER debian:debian
RUN if [ "$TARGETARCH" = amd64 ]; then d2 init-playwright; fi
RUN d2 init-playwright
WORKDIR /home/debian/src
EXPOSE 8080

View file

@ -56,7 +56,10 @@ func startPlaywright(pw *playwright.Playwright) (Playwright, error) {
}
func InitPlaywright() (Playwright, error) {
err := playwright.Install(&playwright.RunOptions{Verbose: false})
err := playwright.Install(&playwright.RunOptions{
Verbose: false,
Browsers: []string{"chromium"},
})
if err != nil {
return Playwright{}, fmt.Errorf("failed to install Playwright: %w", err)
}