Files
kamal/lib/tasks/mrsk/build.rake
David Heinemeier Hansson a1fc01639e Add build:info to check builder
2023-01-13 10:24:23 +01:00

52 lines
1.4 KiB
Ruby

require_relative "setup"
namespace :mrsk do
namespace :build do
desc "Deliver a newly built app image to servers"
task deliver: %i[ push pull ]
desc "Build locally and push app image to registry"
task :push do
run_locally do
begin
debug "Using builder: #{MRSK.builder.name}"
info "Building images may take a while (run with VERBOSE=1 for progress logging)"
execute *MRSK.builder.push
rescue SSHKit::Command::Failed => e
error "Missing compatible builder, so creating a new one first"
execute *MRSK.builder.create
execute *MRSK.builder.push
end
end unless ENV["VERSION"]
end
desc "Pull app image from the registry onto servers"
task :pull do
on(MRSK.config.hosts) { execute *MRSK.builder.pull }
end
desc "Create a local build setup"
task :create do
run_locally do
debug "Using builder: #{MRSK.builder.name}"
execute *MRSK.builder.create
end
end
desc "Remove local build setup"
task :remove do
run_locally do
debug "Using builder: #{MRSK.builder.name}"
execute *MRSK.builder.remove
end
end
desc "Show the name of the configured builder"
task :info do
run_locally do
puts "Builder: #{MRSK.builder.name} (#{MRSK.builder.target.class.name})"
end
end
end
end