From 5c2a80330f653056299ae94ea61f712d19e361da Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 16 Feb 2023 19:38:02 -0800 Subject: [PATCH] docker: Install playwright dependencies on arm64 Also changed our code to only install chromium. Closes #835 --- ci/release/docker/Dockerfile | 8 ++++---- lib/png/png.go | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ci/release/docker/Dockerfile b/ci/release/docker/Dockerfile index 50f51c21a..e0f4b60e2 100644 --- a/ci/release/docker/Dockerfile +++ b/ci/release/docker/Dockerfile @@ -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 diff --git a/lib/png/png.go b/lib/png/png.go index 80d4a51e1..382737cf7 100644 --- a/lib/png/png.go +++ b/lib/png/png.go @@ -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) }