diff --git a/Dockerfile b/Dockerfile index ec19a223..d3a231f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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