Sha256: 4fd10037e48abe6ce25fdccf248b930322ebe804af176cc34dda614dc0288ad4

Contents?: true

Size: 897 Bytes

Versions: 38

Compression:

Stored size: 897 Bytes

Contents

require 'rake_factory'
require 'docker'

module RakeDocker
  module Tasks
    class Push < RakeFactory::Task
      default_name :push
      default_description RakeFactory::DynamicValue.new { |t|
        "Push #{t.image_name} image to repository"
      }

      parameter :image_name, :required => true
      parameter :repository_url, :required => true

      parameter :credentials
      parameter :tags, :required => true

      action do |t|
        Docker.authenticate!(t.credentials) if t.credentials

        images = Docker::Image.all(filter: t.repository_url)
        if images.empty?
          raise ImageNotFound,
              "No image found for repository: '#{t.repository_url}'"
        end

        image = images.first
        t.tags.each do |tag|
          image.push(nil, tag: tag) do |chunk|
            Output.print chunk
          end
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
rake_docker-2.18.0.pre.3 lib/rake_docker/tasks/push.rb
rake_docker-2.18.0.pre.2 lib/rake_docker/tasks/push.rb
rake_docker-2.18.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.17.0 lib/rake_docker/tasks/push.rb
rake_docker-2.16.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.15.0 lib/rake_docker/tasks/push.rb
rake_docker-2.14.0.pre.4 lib/rake_docker/tasks/push.rb
rake_docker-2.14.0.pre.3 lib/rake_docker/tasks/push.rb
rake_docker-2.14.0.pre.2 lib/rake_docker/tasks/push.rb
rake_docker-2.14.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.13.0 lib/rake_docker/tasks/push.rb
rake_docker-2.12.0.pre.2 lib/rake_docker/tasks/push.rb
rake_docker-2.12.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.11.0 lib/rake_docker/tasks/push.rb
rake_docker-2.10.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.9.0 lib/rake_docker/tasks/push.rb
rake_docker-2.8.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.7.0 lib/rake_docker/tasks/push.rb
rake_docker-2.6.0.pre.1 lib/rake_docker/tasks/push.rb
rake_docker-2.5.0 lib/rake_docker/tasks/push.rb