This repository was archived by the owner on Aug 30, 2022. It is now read-only.
File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ WORKDIR /usr/src
4
4
5
5
RUN install_packages chromium
6
6
7
+ COPY token.json .
8
+ COPY credentials.json .
7
9
COPY package*.json ./
8
10
RUN npm install
9
11
@@ -21,6 +23,8 @@ WORKDIR /usr/src
21
23
22
24
RUN install_packages chromium
23
25
26
+ COPY token.json .
27
+ COPY credentials.json .
24
28
COPY package*.json ./
25
29
COPY --from=builder /usr/src/build /usr/src/build
26
30
RUN npm install --production
Original file line number Diff line number Diff line change 1
1
import { Browser , Page } from 'puppeteer' ;
2
2
import puppeteer from 'puppeteer-extra' ;
3
3
import StealthPlugin = require( 'puppeteer-extra-plugin-stealth' ) ;
4
- import * as os from 'os' ;
5
4
6
5
puppeteer . use ( StealthPlugin ( ) ) ;
7
6
7
+ const RUNNING_ALPINE = ! ! process . env . RUNNING_ALPINE ;
8
+
8
9
export async function newBrowser ( ) : Promise < Browser > {
9
10
const puppeteerOptions = {
10
11
headless : true ,
@@ -24,7 +25,8 @@ export async function newBrowser(): Promise<Browser> {
24
25
defaultViewport : { height : 912 , width : 1480 } ,
25
26
} ;
26
27
27
- if ( os . platform ( ) === 'linux' ) {
28
+ if ( RUNNING_ALPINE ) {
29
+ console . log ( 'Running on Alpine, altering puppeteer chromium path...' ) ;
28
30
/* @ts -ignore */
29
31
puppeteerOptions . executablePath = '/usr/bin/chromium-browser' ;
30
32
}
You can’t perform that action at this time.
0 commit comments