-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile: Update and streamline steps (#586)
Does effectively the same things as before, but now in a simpler/faster way. Some of the changes take inspiration from @btyy77c's dockerAlpine branch: https://github.com/btyy77c/refugerestrooms/blob/dockerAlpine/Dockerfile The PhantomJS install is based on (mostly copy-pasted from) @nkovacs' phantomjs image from Docker Hub: https://github.com/nkovacs/selenium-standalone-phantomjs/blob/c5f6bba218472270/Dockerfile#L19-L22
- Loading branch information
Showing
1 changed file
with
33 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
FROM ruby:2.5.3-slim | ||
ENV PHANTOM_JS=2.1.1 | ||
|
||
# Add basic binaries | ||
RUN apt-get update \ | ||
&& apt-get install -y bzip2 curl gnupg wget | ||
|
||
# Add the apt repository for yarn | ||
RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
|
||
# Add the apt-repository for the latest node.js | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
|
||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | ||
RUN apt-get install build-essential chrpath libssl-dev libxft-dev -y && \ | ||
apt-get install libfreetype6 libfreetype6-dev -y && \ | ||
apt-get install libfontconfig1 libfontconfig1-dev -y && \ | ||
cd ~ && \ | ||
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64" && \ | ||
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2 && \ | ||
tar xvjf $PHANTOM_JS.tar.bz2 && \ | ||
mv $PHANTOM_JS /usr/local/share && \ | ||
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin && \ | ||
apt-get install -y yarn | ||
|
||
# Clean up the apt cache | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
&& apt-get install -y curl g++ gcc libfontconfig libpq-dev make patch xz-utils \ | ||
# Clean up the apt cache | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Download, extract and install PhantomJS from archive hosted at bitbucket | ||
RUN curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O \ | ||
# Extract and clean up the PhantomJS archive | ||
&& tar xf phantomjs-2.1.1-linux-x86_64.tar.bz2 && rm phantomjs-2.1.1-linux-x86_64.tar.bz2 \ | ||
# Install PhantomJS binary to /usr/local/bin | ||
&& mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin \ | ||
# Clean up extra (un-needed) PhantomJS files | ||
&& rm -rf phantomjs-2.1.1-linux-x86_64/ | ||
|
||
# Specify a version of Node.js to download and install | ||
ENV NODEJS_VERSION=v10.15.3 | ||
|
||
# Download and extract Node.js from archive supplied by nodejs.org | ||
RUN curl -L https://nodejs.org/dist/$NODEJS_VERSION/node-$NODEJS_VERSION-linux-x64.tar.xz -o nodejs.tar.xz \ | ||
&& tar xf nodejs.tar.xz \ | ||
# Clean up the Node.js archive | ||
&& rm nodejs.tar.xz | ||
|
||
# Add Node.js binaries to PATH (includes Node and NPM, will include Yarn) | ||
ENV PATH="/node-$NODEJS_VERSION-linux-x64/bin/:${PATH}" | ||
|
||
# Install Yarn | ||
RUN npm install -g yarn | ||
|
||
# Make the "/refugerestrooms" folder, run all subsequent commands in that folder | ||
RUN mkdir /refugerestrooms | ||
WORKDIR /refugerestrooms | ||
|
||
COPY Gemfile /refugerestrooms/Gemfile | ||
COPY Gemfile.lock /refugerestrooms/Gemfile.lock | ||
# Install Ruby gems with Bundler | ||
COPY Gemfile Gemfile.lock /refugerestrooms/ | ||
RUN bundle install | ||
|
||
# Install Node.js packages with Yarn | ||
COPY package.json yarn.lock /refugerestrooms/ | ||
RUN yarn --pure-lockfile | ||
RUN yarn install --pure-lockfile |