forked from RefugeRestrooms/refugerestrooms
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Does effectively the same things as before, but now in a simpler/faster way. Some of the changes takes inspiration from @btyy77c's dockerAlpine branch. https://github.com/btyy77c/refugerestrooms/blob/dockerAlpine/Dockerfile The PhantomJS install is based on @werner's phantomjs image from Docker Hub https://github.com/wernight/docker-phantomjs/blob/v2.1.1/Dockerfile Co-authored-by: Emily Ring <[email protected]> Co-authored-by: Werner Beroux <[email protected]>
- Loading branch information
1 parent
8e98144
commit 0626c44
Showing
1 changed file
with
33 additions
and
27 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,44 @@ | ||
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 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 mkdir /phantomjs-extracted \ | ||
&& curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -o phantomjs.tar.bz2 \ | ||
&& tar -xjf phantomjs.tar.bz2 --strip-components=1 --directory=/phantomjs-extracted \ | ||
&& cd /phantomjs-extracted \ | ||
&& mv bin/phantomjs /usr/local/bin \ | ||
&& cd / \ | ||
# Clean up the PhantomJS archive, and the extracted contents | ||
&& rm -rf /phantomjs-extracted /phantomjs.tar.bz2 | ||
|
||
# Specify a version of Node.js to download and install | ||
ENV NODEJS_VERSION=v10.15.0 | ||
|
||
# Download and extract Nodejs 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 tar.xz 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 gems with Bundler | ||
COPY Gemfile Gemfile.lock /refugerestrooms/ | ||
RUN bundle install | ||
|
||
# Install node packages with Yarn | ||
COPY package.json yarn.lock /refugerestrooms/ | ||
RUN yarn --pure-lockfile |