Skip to content

Commit

Permalink
Get RakeCompilerDock to work with either podman or docker, based on w…
Browse files Browse the repository at this point in the history
…hat is installed

* See 479a557
  • Loading branch information
eregon committed Jun 7, 2024
1 parent 66ddae6 commit 8f07f57
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ unless Concurrent.on_jruby? || Concurrent.on_truffleruby?
end
end

def which?(executable)
!`which #{executable} 2>/dev/null`.empty?
end

require 'rake_compiler_dock'
namespace :repackage do
desc '* with Windows fat distributions'
Expand All @@ -42,12 +46,19 @@ namespace :repackage do
Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke

# build all gem files
rack_compiler_dock_kwargs = {}
if which?('podman') and (!which?('docker') || `docker --version`.include?('podman'))
# podman and only podman available, so RakeCompilerDock will use podman, otherwise it uses docker
rack_compiler_dock_kwargs = {
options: ['--privileged'], # otherwise the directory in the image is empty
runas: false
}
end
%w[x86-mingw32 x64-mingw32].each do |plat|
RakeCompilerDock.sh(
"bundle install --local && bundle exec rake native:#{plat} gem --trace",
platform: plat,
options: ['--privileged'], # otherwise the directory in the image is empty
runas: false)
**rack_compiler_dock_kwargs)
end
end
end
Expand Down

0 comments on commit 8f07f57

Please sign in to comment.