Skip to content

Instantly share code, notes, and snippets.

@tarla
Created June 14, 2017 23:07
Show Gist options
  • Save tarla/380e7db0446d576b7b441afb556a7203 to your computer and use it in GitHub Desktop.
Save tarla/380e7db0446d576b7b441afb556a7203 to your computer and use it in GitHub Desktop.
Dockerfile
FROM ruby:2.4.1
MAINTAINER "João Tarla" <joao@tarla.com.br>
RUN apt-get update -qq && apt-get install -y -f --force-yes apt-transport-https && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 && \
echo deb http://archive.ubuntu.com/ubuntu precise main universe > /etc/apt/sources.list && \
echo deb http://archive.ubuntu.com/ubuntu precise-updates main universe >> /etc/apt/sources.list && \
echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main >> /etc/apt/sources.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -qq && apt-get install -y -f --force-yes build-essential libxml2-dev libxslt1-dev postgresql-client-9.6 yarn && \
apt-get clean && apt-get autoremove -y && apt-get autoclean -y
RUN curl -SLO "https://nodejs.org/dist/v7.10.0/node-v7.10.0-linux-x64.tar.xz" \
&& tar -xJf "node-v7.10.0-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v7.10.0-linux-x64.tar.xz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN curl -SLO "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2" && \
tar jxf "phantomjs-2.1.1-linux-x86_64.tar.bz2" -C /usr/local/ --strip-components=1 && \
rm "phantomjs-2.1.1-linux-x86_64.tar.bz2"
ENV APP_HOME /usr/src/app
RUN mkdir -p $APP_HOME && \
useradd -ms /bin/false app_user
WORKDIR $APP_HOME
ADD Gemfile $APP_HOME/Gemfile
ADD Gemfile.lock $APP_HOME/Gemfile.lock
# --- Bundle Setup ---
ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile BUNDLE_PATH=/bundle
# uninstall pre-packaged bundler version in the ruby:2.3.3 docker image
RUN gem uninstall -i /usr/local/lib/ruby/gems/2.4.0 bundler
COPY . $APP_HOME
RUN gem install bundler && \
gem install foreman && \
chown -R app_user:app_user $APP_HOME && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 9000
CMD bundle exec rails s -p 9000 -b 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment