Created
February 27, 2018 06:33
-
-
Save linw1995/3aeaf9f70b41ec9e4769da27b5c30619 to your computer and use it in GitHub Desktop.
Google Chrome Headless Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM google/debian:jessie | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -qqy \ | |
&& apt-get -qqy install \ | |
gnupg wget ca-certificates apt-transport-https \ | |
ttf-wqy-zenhei \ | |
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* | |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
&& echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ | |
&& apt-get update -qqy \ | |
&& apt-get -qqy install google-chrome-stable \ | |
&& rm /etc/apt/sources.list.d/google-chrome.list \ | |
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* | |
RUN wget -O /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 \ | |
&& chmod +x /usr/bin/dumb-init | |
RUN cp /etc/localtime /etc/localtime.bk \ | |
&& rm /etc/localtime \ | |
&& ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | |
&& dpkg-reconfigure tzdata | |
RUN useradd headless --shell /bin/bash --create-home \ | |
&& usermod -a -G sudo headless \ | |
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \ | |
&& echo 'headless:nopassword' | chpasswd | |
RUN mkdir /data && chown -R headless:headless /data | |
USER headless | |
ENTRYPOINT ["/usr/bin/dumb-init", "--", \ | |
"/usr/bin/google-chrome-stable", \ | |
"--disable-gpu", \ | |
"--headless", \ | |
"--no-sandbox", \ | |
"--disable-setuid-sandbox", \ | |
"--hide-scrollbars", \ | |
"--disable-dev-shm-usage", \ | |
"--remote-debugging-address=0.0.0.0", \ | |
"--remote-debugging-port=9222", \ | |
"--user-data-dir=/data"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment