Skip to content

Instantly share code, notes, and snippets.

@manuwell
Last active June 1, 2017 17:51
Show Gist options
  • Save manuwell/5181cf6a4bd2393a4503274402be6dad to your computer and use it in GitHub Desktop.
Save manuwell/5181cf6a4bd2393a4503274402be6dad to your computer and use it in GitHub Desktop.
Ruby Dockerfile
FROM alpine:3.2
MAINTAINER RakutenPayments <infra@rakutenpayments.com.br>
RUN \
echo 'gem: --no-document' >> ~/.gemrc && \
cp ~/.gemrc /etc/gemrc && \
chmod uog+r /etc/gemrc
ENV \
GEM_PATH="/app/vendor/bundle/ruby/2.2.0/" \
RUBY_VERSION="2.2.3-r0"
ENV \
BUILD_PACKAGES="curl-dev ruby-dev=$RUBY_VERSION build-base" \
DEV_PACKAGES="zlib-dev libxml2-dev libxslt-dev tzdata postgresql-dev" \
RUBY_PACKAGES="ruby=$RUBY_VERSION ruby-io-console=$RUBY_VERSION libpq" \
NOKOGIRI_USE_SYSTEM_LIBRARIES=1
RUN \
apk --update --upgrade add $BUILD_PACKAGES $RUBY_PACKAGES $DEV_PACKAGES && \
gem install -N bundler
WORKDIR /app
ADD Gemfile* /app/
RUN \
bundle install --without="development test"
# cleanup and settings
RUN \
apk del curl-dev && \
apk del ruby-base build-base && \
apk del $DEV_PACKAGES && \
find / -type f -iname \*.apk-new -delete && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/lib/ruby/gems/*/cache/* && \
rm -rf ~/.gem
# ensure gems installed
RUN \
bundle install --without="development test"
ADD . /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment