Skip to content

Commit

Permalink
Clean up Dockerfile steps
Browse files Browse the repository at this point in the history
Re-organize, add explanatory comments,
and delete unnecessary package installations.
  • Loading branch information
DeeDeeG committed Oct 8, 2018
1 parent 808aaea commit cb258ad
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
FROM ruby:2.3.7
ENV PHANTOM_JS=2.1.1

# 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 and install node.js
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get install -y nodejs

# Add the apt-repository for the latest node.js
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
# Add the apt repository for yarn and install 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 && \
apt-get update && apt-get install -y yarn

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 ~ && \
# Install PhantomJS
RUN 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
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

# Establish working directory in Docker container's /refugerestrooms folder
RUN mkdir /refugerestrooms
WORKDIR /refugerestrooms

# Install Gems
COPY Gemfile /refugerestrooms/Gemfile
COPY Gemfile.lock /refugerestrooms/Gemfile.lock
RUN bundle install

# Install Node.js packages
COPY package.json yarn.lock /refugerestrooms/
RUN yarn --pure-lockfile

0 comments on commit cb258ad

Please sign in to comment.