πŸͺ„

Setup Puppeteer without OS-UI run on Docker

Setup docker image to run puppeteer without Operator User Interface, I use this setup for scraping client javascript web applications. πŸ€Έβ€β™‚οΈπŸ€Έβ€β™‚οΈπŸ€Έβ€β™‚οΈ
FROM node:12.18.0

RUN  apt-get update \
	&& apt-get install -y wget gnupg ca-certificates \
	&& 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 \
	&& apt-get install -y google-chrome-stable \
	&& rm -rf /var/lib/apt/lists/* \
	&& wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
	&& chmod +x /usr/sbin/wait-for-it.sh
# add index.js file 
ADD index.js /
ADD package.json package-lock.json /
RUN npm install

CMD ["node", "index.js"]
Β