forked from leonardocouy/docker-alpine-pg-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (30 loc) · 1.41 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM alpine:3.7
LABEL maintainer="Leonardo Flores <[email protected]>"
ARG RUBY_VERSION
ENV BUILD_DEPS="curl tar wget linux-headers" \
DEV_DEPS="build-base postgresql-dev zlib-dev libxml2-dev libxslt-dev readline-dev tzdata git nodejs"
RUN apk add --update --upgrade $BUILD_DEPS $DEV_DEPS
## Install specified ruby version
## if ruby version is not present, it will install latest ruby version
RUN \
RUBY_VERSION_LIST="https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt" \
&& LATEST_RUBY_VERSION=$(\curl -sS $RUBY_VERSION_LIST| tail -1) \
&& SELECTED_RUBY_VERSION=${RUBY_VERSION:-$LATEST_RUBY_VERSION} \
&& echo Installing Ruby $SELECTED_RUBY_VERSION \
&& wget -L "http://ftp.ruby-lang.org/pub/ruby/ruby-$SELECTED_RUBY_VERSION.tar.gz" \
&& tar xvzf ruby-$SELECTED_RUBY_VERSION.tar.gz \
&& rm ruby-$SELECTED_RUBY_VERSION.tar.gz \
&& cd ruby-$SELECTED_RUBY_VERSION \
&& export ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
&& ./configure --enable-shared --disable-install-doc \
&& make -j 4 \
&& make install \
&& rm -rf /ruby-$RUBY_VERSION
## Install bundler, disable bundler warning and prevents install gem documentations
RUN gem install -N bundler \
&& bundle config --global silence_root_warning 1 \
&& echo -e 'gem: --no-document' >> /etc/gemrc
# Clean and uninstall
RUN apk del $BUILD_DEPS \
&& rm -rf /var/cache/apk/* \
&& rm -rf /usr/lib/ruby/gems/*/cache/*;