2022-07-25 12:34:01 +00:00
|
|
|
FROM node:16
|
|
|
|
|
|
|
|
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
|
|
|
|
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
|
|
|
|
# installs, work.
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y wget gnupg \
|
|
|
|
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
|
|
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
|
|
|
&& apt-get update \
|
2022-08-18 06:57:00 +00:00
|
|
|
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 \
|
2022-07-25 12:34:01 +00:00
|
|
|
--no-install-recommends \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
WORKDIR /home/pptruser
|
|
|
|
|
|
|
|
COPY puppeteer-latest.tgz /home/pptruser/puppeteer-latest.tgz
|
2022-10-05 12:17:03 +00:00
|
|
|
COPY puppeteer-core-latest.tgz /home/pptruser/puppeteer-core-latest.tgz
|
2022-07-25 12:34:01 +00:00
|
|
|
|
2022-10-05 12:17:03 +00:00
|
|
|
# Install puppeteer and puppeteer-core into /home/pptruser/node_modules.
|
|
|
|
RUN npm i ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \
|
|
|
|
&& rm ./puppeteer-core-latest.tgz ./puppeteer-latest.tgz \
|
2022-07-25 12:34:01 +00:00
|
|
|
# Add user so we don't need --no-sandbox.
|
|
|
|
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
|
|
|
|
&& groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
|
|
|
|
&& mkdir -p /home/pptruser/Downloads \
|
|
|
|
&& chown -R pptruser:pptruser /home/pptruser \
|
|
|
|
&& (node -e "require('child_process').execSync(require('puppeteer').executablePath() + ' --credits', {stdio: 'inherit'})" > THIRD_PARTY_NOTICES)
|
|
|
|
|
|
|
|
USER pptruser
|
|
|
|
|
|
|
|
CMD ["google-chrome-stable"]
|