From 9db2648725fe75300dd71ef50e6bf21071a80f14 Mon Sep 17 00:00:00 2001 From: erik <758402+erikarenhill@users.noreply.github.com> Date: Wed, 4 Sep 2024 07:34:50 +0200 Subject: [PATCH] chore: adding suggested deps for chromium-aws-lambda --- Dockerfile | 25 ++++++++++++++----------- config.yaml | 2 +- index.js | 11 ++--------- package.json | 2 +- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ae9699..0d9279d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ ARG BUILD_FROM FROM $BUILD_FROM -# Install dependencies -RUN apk add --no-cache \ +# Install dependencies for chrome-aws-lambda +RUN apk --no-cache add \ nodejs \ npm \ nss \ @@ -13,13 +13,16 @@ RUN apk add --no-cache \ python3 \ make \ g++ \ - chromium \ - udev \ - dumb-init \ - libstdc++ \ - libc6-compat \ - chromium-chromedriver - + curl \ + fontconfig \ + alsa-lib \ + at-spi2-core \ + cairo \ + cups-libs \ + dbus-glib \ + eudev-libs \ + expat \ + ttf-opensans # Set the working directory WORKDIR /usr/src/app @@ -27,8 +30,8 @@ WORKDIR /usr/src/app # Copy package.json and package-lock.json COPY package*.json ./ -# Install app dependencies -RUN npm ci +# Install Puppeteer and chrome-aws-lambda dependencies +RUN npm install # Copy app source COPY . . diff --git a/config.yaml b/config.yaml index 5be34e0..3f2edc1 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ name: "Geodnet Headless Console API" description: "API for Geodnet Console data" -version: "1.0.9" +version: "1.0.10" slug: "geodnet_headless_console_api" init: false arch: diff --git a/index.js b/index.js index 5764393..c35c0f5 100644 --- a/index.js +++ b/index.js @@ -87,15 +87,8 @@ async function setupBrowserAndPage(key) { try { console.log(`Configuring launch options for key: ${key}`); const launchOptions = { - args: [ - '--no-sandbox', - '--disable-setuid-sandbox', - '--disable-dev-shm-usage', - '--disable-accelerated-2d-canvas', - '--no-first-run', - '--no-zygote', - '--disable-gpu' - ], + args: [...chromium.args, '--no-sandbox', '--disable-setuid-sandbox'], + executablePath: await chromium.executablePath, headless: true, }; diff --git a/package.json b/package.json index 27cf5e4..8a4653e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "geodnet-headless-console-api", - "version": "1.0.9", + "version": "1.0.10", "description": "", "main": "index.js", "scripts": {