Skip to content

Instantly share code, notes, and snippets.

@wowlusitong
Forked from linw1995/Dockerfile
Created March 17, 2018 04:25
Show Gist options
  • Save wowlusitong/a4aa2af0ee5369b55e0fa4f67dceedb6 to your computer and use it in GitHub Desktop.
Save wowlusitong/a4aa2af0ee5369b55e0fa4f67dceedb6 to your computer and use it in GitHub Desktop.
Google Chrome Headless Docker
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