Skip to content

Instantly share code, notes, and snippets.

@csexton
Created February 17, 2016 03:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save csexton/f41fbf3bb415c0aacec2 to your computer and use it in GitHub Desktop.
Save csexton/f41fbf3bb415c0aacec2 to your computer and use it in GitHub Desktop.
Minimal Dockerfile for Alpine Linux with configurable ruby helper script
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 git
ENV BUILD_PACKAGES build-base libc-dev linux-headers openssl-dev postgresql-dev libxml2-dev libxslt-dev
RUN apk update && \
apk upgrade && \
apk add $BASE_PACKAGES && \
rm -rf "/var/cache/apk/*"
COPY ./script/install-ruby /usr/local/bin/install-ruby
RUN apk --update add --virtual build_deps $BUILD_PACKAGES && \
install-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
#!/bin/sh
RUBY_VERSION=$1
set -e
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment