Skip to content

Instantly share code, notes, and snippets.

@olkeene
Last active February 2, 2017 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olkeene/9aa2b51302e1bfd962a8bb8f499c315e to your computer and use it in GitHub Desktop.
Save olkeene/9aa2b51302e1bfd962a8bb8f499c315e to your computer and use it in GitHub Desktop.
FROM ruby:2.1-slim
RUN apt-get update -qq && \
apt-get install -y \
build-essential git \
libmysqlclient-dev mysql-client libxslt-dev libxml2-dev \
curl net-tools --no-install-recommends
ENV NVM_DIR "/root/.nvm"
ENV NVM_VERSION 0.33.0
ENV NODE_VERSION 7.5.0
RUN curl https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
WORKDIR /tmp
RUN curl -o sphinx.tar.gz http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz \
&& tar -zxvf sphinx.tar.gz > /dev/null \
&& curl -o libstemmer_c.tgz http://snowball.tartarus.org/dist/libstemmer_c.tgz \
&& tar -xvzf libstemmer_c.tgz > /dev/null \
&& cd sphinx-*/ \
&& cp -R ../libstemmer_c/* ./libstemmer_c \
&& ./configure --with-mysql --with-libstemmer > /dev/null \
&& make > /dev/null && make install > /dev/null
# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV APP /app
ENV BUNDLE_PATH /bundle
VOLUME /bundle
# Gems
RUN gem install bundler
ADD Gemfile .
ADD Gemfile.lock .
ADD vendor .
RUN bundle install --jobs 4 --retry 5
ADD package.json .
# If npm was invoked with root privileges,
# then it will change the uid to the user account or uid specified by the user config,
# which defaults to nobody.
# Set the unsafe-perm flag to run scripts with root privileges.
# https://docs.npmjs.com/misc/scripts#user
RUN npm install --unsafe-perm
# App
RUN mkdir $APP
WORKDIR $APP
ADD . $APP
EXPOSE 3000
ENTRYPOINT bin/docker-entrypoint.sh $0 $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment