chromium-browser headless
All checks were successful
build / build (push) Successful in 1m58s

This commit is contained in:
cheetah 2025-04-06 02:44:07 +02:00
parent ec5a6d030f
commit e7db110b77
2 changed files with 9 additions and 14 deletions

View file

@ -4,27 +4,22 @@ FROM node:${NODE_VERSION}-alpine
ENV NODE_ENV production ENV NODE_ENV production
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV CHROME_BIN="/usr/bin/chromium-browser"\
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
RUN apk add --no-cache \ RUN apk add --no-cache \
chromium \ chromium \
nss \ nss \
freetype \ udev \
freetype freetype-dev \
harfbuzz \ harfbuzz \
ca-certificates \ ca-certificates \
ttf-freefont \ ttf-freefont \
nodejs \ nodejs \
python3 g++ make py3-pip python3 g++ make py3-pip
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Add user so we don't need --no-sandbox.
# RUN addgroup -S node && adduser -S -G pptruser pptruser \
# && mkdir -p /home/node/Downloads /app \
# && chown -R node:node /home/pptruser \
# && chown -R node:node /app
WORKDIR /usr/src/app WORKDIR /usr/src/app
ENV CHROME_BIN="/usr/bin/chromium-browser"\
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
COPY package.json . COPY package.json .
RUN npm install puppeteer RUN npm install puppeteer
RUN npm install RUN npm install

View file

@ -40,10 +40,10 @@ class eMessagePuppeteerConnectorBase extends Connector {
let sendPromise = () => new Promise(async (res, rej) => { let sendPromise = () => new Promise(async (res, rej) => {
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: true, headless: "new",
executablePath: '/usr/bin/chromium', // executablePath: '/usr/bin/chromium',
executablePath: '/usr/bin/chromium-browser', executablePath: '/usr/bin/chromium-browser',
args: ['--no-sandbox', '--disable-dev-shm-usage'], args: ['--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage'],
}) })
this.connectorRegistry.reportState(msg, UUID, 'puppettering') this.connectorRegistry.reportState(msg, UUID, 'puppettering')
const page = await browser.newPage() const page = await browser.newPage()