Last active
April 6, 2017 02:56
-
-
Save leaysgur/97e3aeb36795bfc0125fc1fa9d6ff90e to your computer and use it in GitHub Desktop.
Docker image for node 6.x latest and yarn and karma w/ headless chrome
This file contains hidden or 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
# yarn included | |
FROM node:6 | |
# for installing chrome | |
RUN apt-get update -qqy \ | |
&& apt-get -qqy install \ | |
apt-transport-https \ | |
ca-certificates \ | |
ttf-wqy-zenhei \ | |
ttf-unfonts-core \ | |
wget | |
# install chrome | |
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/* | |
WORKDIR /workspace |
This file contains hidden or 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 https://github.com/karma-runner/karma/issues/2603 | |
{ | |
// ... | |
browsers: ['ChromeNoSandboxHeadless'], | |
customLaunchers: { | |
ChromeNoSandboxHeadless: { | |
base: 'Chrome', | |
flags: [ | |
'--no-sandbox', | |
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md | |
'--headless', | |
'--disable-gpu', | |
// Without a remote debugging port, Google Chrome exits immediately. | |
' --remote-debugging-port=9222', | |
], | |
}, | |
}, | |
// ... | |
} |
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update -qq && apt-get install -qq \
google-chrome-stable \
&& rm /etc/apt/sources.list.d/google-chrome.list \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
もはやこんだけでchrome
入る疑惑
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
めも1
いんたーねっと情報だと、Yarnは個別に入れるしかない風にみえる。
けど実際には、Nodeの公式イメージの中にあるやつにはだいたい最初から入ってる。
めも2
いんたーねっと情報だと、ヘッドレスなChromeを動かすには
Xvfb
が必要・・みたいな記事ばっか出てくる。ただ、現世においてはもう
stable
でもヘッドレスモードで起動できるっぽいので、あれこれ楽できそう。ただしいつのバージョンで入ったのかは不明でLinuxだから入ってるとかもあるかもしれないけどよく調べてない。