IMAGE alpine3.12-ruby2.7_2.7.2-210106 FROM alpine3.12_3.12.3-210106 RUN EOF # Install Ruby runtime dependencies apk --no-cache add gdbm zlib # Install Ruby build dependencies apk --no-cache add --virtual .deps build-base autoconf gdbm-dev libressl-dev linux-headers readline-dev zlib-dev # Download and unpack Ruby mkdir -p /usr/src/ruby wget http://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.xz -O - | tar xJf - -C /usr/src/ruby --strip-components=1 # Compile and install Ruby cd /usr/src/ruby # Hackfix thread stack size # https://github.com/docker-library/ruby/issues/196, https://bugs.ruby-lang.org/issues/14387 wget 'https://bugs.ruby-lang.org/attachments/download/7081/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch' -O thread-stack-fix.patch patch -p1 -i thread-stack-fix.patch autoconf # Hackfix isnan/isinf macros export ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --build=x86_64-linux-musl --disable-install-doc --enable-shared make -j $(getconf _NPROCESSORS_ONLN) make install # Install RubyGems and Bundler mkdir -p /usr/local/etc echo -e 'install: --no-document\nupdate: --no-document' >/usr/local/etc/gemrc gem update --system # Cleanup apk --no-cache del .deps cd /root rm -r /usr/src/ruby rm -rf /root/.gem EOF