Skip to content

Instantly share code, notes, and snippets.

@dakatsuka
Last active November 7, 2017 05:20
Show Gist options
  • Save dakatsuka/0fbf913d535c590d3c42cce081bfe06b to your computer and use it in GitHub Desktop.
Save dakatsuka/0fbf913d535c590d3c42cce081bfe06b to your computer and use it in GitHub Desktop.
Dockerfile for Rails
FROM ruby:2.4.2
MAINTAINER Dai Akatsuka <d.akatsuka@gmail.com>
ENV DOCKER 1
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 8.9.0
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
ENV ENTRYKIT_VERSION 0.4.0
ENV APP_ROOT /app
WORKDIR $APP_ROOT
RUN apt-get update \
&& apt-get install -y cmake \
libicu-dev \
build-essential \
postgresql-client \
apt-transport-https \
&& rm -rf /var/lib/apt/lists/*
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
RUN 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 \
&& apt-get install -y yarn \
&& rm -rf /var/lib/apt/lists/*
RUN \
echo 'gem: --no-document' >> ~/.gemrc \
&& cp ~/.gemrc /etc/gemrc \
&& chmod uog+r /etc/gemrc \
&& bundle config --global build.nokogiri --use-system-libraries \
&& bundle config --global jobs 4 \
COPY Gemfile $APP_ROOT
COPY Gemfile.lock $APP_ROOT
COPY . $APP_ROOT
RUN bundle install --path vendor/bundle \
&& yarn install \
&& bundle exec rake assets:precompile
CMD bundle exec puma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment