namespace :docker do task :jenkins do fail 'Not in a Jenkins environment' \ if ENV['BUILD_NUMBER'].nil? Rake::Task[:'docker:push'].invoke end task :jenkins_fake do ENV['BUILD_NUMBER'] = '1234' Rake::Task[:'docker:jenkins'].invoke end task build: :prepare do @docker_builder.build end task tag: :build do @docker_builder.tag end task push: :tag do @docker_builder.push end end