Skip to content

Commit

Permalink
logic explicitly refers to manylinux
Browse files Browse the repository at this point in the history
instead of the obscure `platform =~ /linux/`
  • Loading branch information
flavorjones committed Sep 28, 2021
1 parent 1783652 commit 1fd116a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 %><%
Expand All @@ -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 " \
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fd116a

Please sign in to comment.