File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 2
2
FROM node:20.15.0-slim as builder
3
3
ENV NODE_ENV=production
4
4
5
+ # We don't need the standalone Chromium
6
+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
7
+
8
+ # Install Google Chrome Stable and fonts
9
+ # Note: this installs the necessary libs to make the browser work with Puppeteer.
10
+ RUN apt-get update && apt-get install gnupg wget -y && \
11
+ wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
12
+ sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
13
+ apt-get update && \
14
+ apt-get install google-chrome-stable -y --no-install-recommends && \
15
+ rm -rf /var/lib/apt/lists/*
16
+
5
17
# Set working directory
6
18
WORKDIR /app
7
19
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ const puppeteer = require("puppeteer");
7
7
* Extracts the relevant information from the course page
8
8
*/
9
9
async function extractRating ( url ) {
10
- const browser = await puppeteer . launch ( ) ;
10
+ const browser = await puppeteer . launch ( {
11
+ executablePath : "/usr/bin/google-chrome" ,
12
+ } ) ;
11
13
12
14
const page = await browser . newPage ( ) ;
13
15
await page . goto ( url , { waitUntil : "networkidle2" } ) ;
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
node deploy-commands.js
3
- npx puppeteer browsers install chrome
4
3
node index.js
You can’t perform that action at this time.
0 commit comments