Skip to content

Commit 8f07f57

Browse files
committed
Get RakeCompilerDock to work with either podman or docker, based on what is installed
* See 479a557
1 parent 66ddae6 commit 8f07f57

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Rakefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ unless Concurrent.on_jruby? || Concurrent.on_truffleruby?
2828
end
2929
end
3030

31+
def which?(executable)
32+
!`which #{executable} 2>/dev/null`.empty?
33+
end
34+
3135
require 'rake_compiler_dock'
3236
namespace :repackage do
3337
desc '* with Windows fat distributions'
@@ -42,12 +46,19 @@ namespace :repackage do
4246
Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke
4347

4448
# build all gem files
49+
rack_compiler_dock_kwargs = {}
50+
if which?('podman') and (!which?('docker') || `docker --version`.include?('podman'))
51+
# podman and only podman available, so RakeCompilerDock will use podman, otherwise it uses docker
52+
rack_compiler_dock_kwargs = {
53+
options: ['--privileged'], # otherwise the directory in the image is empty
54+
runas: false
55+
}
56+
end
4557
%w[x86-mingw32 x64-mingw32].each do |plat|
4658
RakeCompilerDock.sh(
4759
"bundle install --local && bundle exec rake native:#{plat} gem --trace",
4860
platform: plat,
49-
options: ['--privileged'], # otherwise the directory in the image is empty
50-
runas: false)
61+
**rack_compiler_dock_kwargs)
5162
end
5263
end
5364
end

0 commit comments

Comments
 (0)