Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit f4eea6f

Browse files
committed
Update Dockerfile, install Chrome and Chromedriver
as wraith now supports headless chrome, it can be installed in the docker container - also update nodejs to version 8 and use the ruby version specified by the repository's .ruby-version file
1 parent 7adfb1b commit f4eea6f

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

Dockerfile

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
1-
FROM ruby:2.1.2
1+
FROM ruby:2.4.1
22

3-
# some of ruby's build scripts are written in ruby
4-
# we purge this later to make sure our final image uses what we just built
5-
RUN apt-get update
6-
RUN echo "export phantomjs=/usr/bin/phantomjs" > .bashrc
7-
RUN apt-get install -y libfreetype6 libfontconfig1 nodejs npm libnss3-dev libgconf-2-4
8-
RUN ln -s /usr/bin/nodejs /usr/bin/node
9-
RUN npm install npm
10-
RUN npm install -g phantomjs@2.1.7 casperjs@1.1.1
3+
WORKDIR /wraith
4+
5+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
6+
RUN apt-get install -y libfreetype6 libfontconfig1 nodejs libnss3-dev libgconf-2-4 \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
# make sure npm does not need sudo: https://docs.npmjs.com/getting-started/fixing-npm-permissions
10+
RUN mkdir /wraith/.npm-global
11+
ENV NPM_CONFIG_PREFIX=/wraith/.npm-global
12+
ENV PATH=/wraith/.npm-global/bin:$PATH
13+
14+
# install with --unsafe-perm because of https://github.com/Medium/phantomjs/issues/707
15+
RUN npm install -g phantomjs-prebuilt casperjs --unsafe-perm
1116
RUN gem install wraith --no-rdoc --no-ri
1217
RUN gem install aws-sdk --no-rdoc --no-ri
1318

19+
# install chrome and chromedriver (unzip is needed for installing chromedriver)
20+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
21+
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
22+
&& apt-get update \
23+
&& apt-get install -y google-chrome-stable unzip \
24+
&& rm -rf /var/lib/apt/lists/* \
25+
&& sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
26+
"/opt/google/chrome/google-chrome" \
27+
&& google-chrome --version
28+
29+
RUN export CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE) \
30+
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
31+
&& cd /tmp \
32+
&& unzip chromedriver_linux64.zip \
33+
&& rm -rf chromedriver_linux64.zip \
34+
&& mv chromedriver /usr/local/bin/chromedriver \
35+
&& chmod +x /usr/local/bin/chromedriver \
36+
&& chromedriver --version
37+
1438
# Make sure decent fonts are installed. Thanks to http://www.dailylinuxnews.com/blog/2014/09/things-to-do-after-installing-debian-jessie/
1539
RUN echo "deb http://ftp.us.debian.org/debian jessie main contrib non-free" | tee -a /etc/apt/sources.list
1640
RUN echo "deb http://security.debian.org/ jessie/updates contrib non-free" | tee -a /etc/apt/sources.list

0 commit comments

Comments
 (0)