Skip to content

Commit

Permalink
chore: downgrade alpine version to 3.19 to avoid issue
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Sep 30, 2024
1 parent 57ebaf6 commit e6df595
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ RUN apt update
RUN cd reporter && go build .

# Base ------------------------------
FROM node:20-alpine AS base
# The current Chromium version in Alpine 3.20 is causing timeout issues with Puppeteer. Downgrading to Alpine 3.19 fixes the issue. See #11640, #12637, #12189
FROM node:20-alpine3.19 AS base

RUN npm install -g pnpm@9.7.1
RUN apk add --update --no-cache python3 py3-pip g++ make
Expand Down Expand Up @@ -38,9 +39,12 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV DEBUG=puppeteer:*

RUN apk add --no-cache \
udev \
ttf-freefont \
chromium
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont

COPY . .

Expand Down
7 changes: 4 additions & 3 deletions src/server/utils/screenshot/lighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ export async function generateLighthouse(url: string): Promise<Result> {
const browser = await puppeteer.launch({
// Set to false if you want to see the script in action.
headless: 'new',
args: ['--no-sandbox', '--single-process'],
args: ['--no-sandbox', '--single-process', '--disable-dev-shm-usage'],
defaultViewport: null,
ignoreDefaultArgs: ['--enable-automation'],
dumpio: true,
});

try {
Expand All @@ -31,11 +30,13 @@ export async function generateLighthouse(url: string): Promise<Result> {
throw new Error('Lighthouse failed to generate report');
}

page.close({ runBeforeUnload: false });
await page.close({ runBeforeUnload: false });

const { lhr } = res;

return lhr;
} catch (err) {
throw err;
} finally {
await browser.close();
}
Expand Down

0 comments on commit e6df595

Please sign in to comment.