Last active
February 17, 2016 02:57
-
-
Save csexton/9b2e75120fb7f23d7dae to your computer and use it in GitHub Desktop.
Minimal Dockerfile for Alpine Linux, configurable Ruby version, no build tools, final image size about 200 M.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.3 | |
MAINTAINER Christopher Sexton <chris@radiusnetworks.com> | |
ENV RUBY_VERSION 2.3.0 | |
ENV RUBY_DOWNLOAD_SHA1 96e620e38af351c8da63e40cfe217ec79f912ba1 | |
ENV BASE_PACKAGES bash curl gmp | |
ENV BUILD_PACKAGES build-base libc-dev linux-headers openssl-dev postgresql-dev libxml2-dev libxslt-dev | |
# Update and install all of the required packages. | |
# At the end, remove the apk cache | |
RUN apk update && \ | |
apk upgrade && \ | |
apk add $BASE_PACKAGES && \ | |
rm -rf "/var/cache/apk/*" | |
RUN apk --update add --virtual build_deps $BUILD_PACKAGES && \ | |
cd /tmp && \ | |
wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION%.*}/ruby-$RUBY_VERSION.tar.xz" && \ | |
echo "$RUBY_DOWNLOAD_SHA1 ruby.tar.xz" | sha1sum -c - && \ | |
tar -xJf ruby.tar.xz && \ | |
rm ruby.tar.xz && \ | |
cd "/tmp/ruby-$RUBY_VERSION" && \ | |
./configure --disable-install-doc && \ | |
make && \ | |
make install && \ | |
rm -rf "/tmp/ruby-$RUBY_VERSION" && \ | |
apk del build_deps && \ | |
rm -rf "/var/cache/apk/*" | |
RUN gem install bundler --no-rdoc --no-ri | |
RUN mkdir /app | |
WORKDIR /app | |
COPY Gemfile /app/ | |
COPY Gemfile.lock /app/ | |
RUN bundle install | |
COPY . /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment