try with docker

This commit is contained in:
andres
2023-03-14 01:37:58 +01:00
parent 43d147effb
commit d43e71757d
2 changed files with 21 additions and 1 deletions

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/playwright:v1.31.0-focal
WORKDIR /app
COPY package.json /app/
COPY pnpm-lock.yaml /app/
COPY features/ /app/features/
COPY src/ /app/src/
COPY tsconfig.json /app/
RUN apt-get update && apt-get -y install libnss3 libatk-bridge2.0-0 libdrm-dev libxkbcommon-dev libgbm-dev libasound-dev libatspi2.0-0 libxshmfence-dev
RUN npm install -g pnpm
RUN pnpm install
RUN npx playwright install
RUN pnpm run start

View File

@@ -102,7 +102,14 @@ const step6 = async (page: Page) => {
}
const scrape = async () => {
const browser = await chromium.launch({ timeout: 200000 })
const browser = await chromium.launch({
timeout: 200000,
logger: {
isEnabled: (name, severity) => name === 'browser',
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
log: (name, severity, message, args) => { console.log(`${name} ${message}`) }
}
})
try {
const page = await browser.newPage()
console.log('scraping...')