FROM ubuntu:18.04 RUN apt-get -y update && \ apt-get install -y curl git-core xz-utils wget unzip sudo gpg dirmngr openjdk-11-jdk-headless # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000 RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \ echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc USER rvm # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \ (curl -L http://get.rvm.io | sudo bash -s stable) && \ bash -c " \ source /etc/rubybashrc && \ rvmsudo rvm cleanup all " # Import patch files for ruby and gems COPY build/patches /home/rvm/patches/ ENV BASH_ENV /etc/rubybashrc # install rubies and fix permissions on RUN bash -c " \ export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \ for v in jruby-9.2.5.0 ; do \ rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \ done && \ rvm cleanup all && \ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw " # Install rake-compiler and typical gems in all Rubies # do not generate documentation for gems RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \ bash -c " \ rvm all do gem install --no-document bundler 'bundler:~>1.16' rake-compiler hoe rubygems-tasks && \ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw " # Install rake-compiler's cross rubies in global dir instead of /root RUN sudo mkdir -p /usr/local/rake-compiler && \ sudo chown rvm.rvm /usr/local/rake-compiler && \ ln -s /usr/local/rake-compiler ~/.rake-compiler USER root RUN bash -c "rvm alias create default jruby-9.2.5.0" RUN echo "rvm use jruby-9.2.5.0 > /dev/null" >> /etc/rubybashrc # Add rvm to the global bashrc RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc # Install SIGINT forwarder COPY build/sigfw.c /root/ RUN gcc $HOME/sigfw.c -o /usr/local/bin/sigfw # Install user mapper COPY build/runas /usr/local/bin/ # Install sudoers configuration COPY build/sudoers /etc/sudoers.d/rake-compiler-dock CMD bash