diff --git a/Dockerfile.mri.erb b/Dockerfile.mri.erb index ef4ace7a..4be81e23 100644 --- a/Dockerfile.mri.erb +++ b/Dockerfile.mri.erb @@ -1,11 +1,14 @@ -FROM <%= - case platform - when /x86_64-linux/ then "quay.io/pypa/manylinux2014_x86_64" - when /x86-linux/ then "quay.io/pypa/manylinux2014_i686" - else "ubuntu:20.04" - end %> - -<% if platform=~/linux/ %> +<% +image = case platform + when /x86_64-linux/ then "quay.io/pypa/manylinux2014_x86_64" + when /x86-linux/ then "quay.io/pypa/manylinux2014_i686" + else "ubuntu:20.04" +end +manylinux = !!(image =~ manylinux) +%> +FROM <%= image %> + +<% if manylinux %> # install packages which rvm will require RUN yum install -y autoconf gcc-c++ libtool readline-devel sqlite-devel ruby openssl-devel xz cmake sudo less @@ -72,7 +75,7 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \ # Add cross compilers for Windows and Linux USER root -<% if platform !~ /linux/ %> +<% unless manylinux %> RUN apt-get -y update && \ apt-get install -y <% if platform=~/darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><% @@ -85,7 +88,7 @@ RUN bash -c " \ rvm alias create default 2.5.8 && \ rvm use default " -<% if platform=~/linux/ %> +<% if manylinux %> # Create dev tools x86-linux-* COPY build/mk_i686.rb /root/ RUN bash -c " \ @@ -200,7 +203,7 @@ RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \ printf "1\n" | update-alternatives --config <%= target %>-g++ <% end %> -<% if platform=~/linux/ %> +<% if manylinux %> # Enable modern compiler toolset of manylinux image RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc diff --git a/Rakefile b/Rakefile index 9482c990..e3bed163 100644 --- a/Rakefile +++ b/Rakefile @@ -26,7 +26,7 @@ namespace :build do sh "docker build -t #{DOCKERHUB_USER}/rake-compiler-dock-mri-#{platform}:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.mri.#{platform} ." end - df = ERB.new(File.read("Dockerfile.mri.erb")).result(binding) + df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding) File.write(sdf, df) CLEAN.include(sdf) end