diff --git a/Dockerfile b/Dockerfile index 077971c..16fb436 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:alpine-2.1.4 +FROM denoland/deno:2.1.4 ENV DATA_DIR=/app/data @@ -6,8 +6,7 @@ WORKDIR /app COPY . . -RUN apk add curl libstdc++ gtk+3.0 alsa-lib &&\ - deno run -A npm:playwright install chromium-headless-shell &&\ +RUN deno run -A npm:playwright install --with-deps firefox &&\ deno install --allow-import --allow-ffi --allow-scripts=npm:sharp@0.33.5-rc.1 -e main.ts &&\ sed -i -e 's/"deno"/"no-deno"/' node_modules/@libsql/client/package.json &&\ mkdir -p $DATA_DIR diff --git a/lib/playwright.ts b/lib/playwright.ts index 2d2f102..4df57ff 100644 --- a/lib/playwright.ts +++ b/lib/playwright.ts @@ -1,4 +1,4 @@ -import { chromium } from "npm:playwright-extra"; +import { firefox } from "npm:playwright-extra"; import { createStreamResponse } from "@lib/helpers.ts"; import StealthPlugin from "npm:puppeteer-extra-plugin-stealth"; @@ -9,7 +9,7 @@ const userAgentStrings = [ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36", ]; -chromium.use(StealthPlugin()); +firefox.use(StealthPlugin()); export async function fetchHtmlWithPlaywright( fetchUrl: string, @@ -17,7 +17,7 @@ export async function fetchHtmlWithPlaywright( ): Promise { streamResponse.enqueue("booting up playwright"); // Launch the Playwright browser - const browser = await chromium.launch(); + const browser = await firefox.launch(); streamResponse.enqueue("fetching html");