Sha256: 41b1fc886681caa86c6bfd631d92cab049793939623bb11faad15290b2bb89d8

Contents?: true

Size: 852 Bytes

Versions: 38

Compression:

Stored size: 852 Bytes

Contents

require 'rake_factory'
require 'docker'

module RakeDocker
  module Tasks
    class Tag < RakeFactory::Task
      default_name :tag
      default_description RakeFactory::DynamicValue.new { |t|
        "Tag #{t.image_name} image for repository"
      }

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

      parameter :tags, :required => true

      action do |t|
        images = Docker::Image.all(filter: t.repository_name)
        if images.empty?
          raise ImageNotFound,
              "No image found with name: '#{t.image_name}'"
        end

        image = images.first

        t.tags.each do |tag|
          image.tag(repo: t.repository_url,
              tag: tag,
              force: true)
        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/tag.rb
rake_docker-2.18.0.pre.2 lib/rake_docker/tasks/tag.rb
rake_docker-2.18.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.17.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.16.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.15.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.14.0.pre.4 lib/rake_docker/tasks/tag.rb
rake_docker-2.14.0.pre.3 lib/rake_docker/tasks/tag.rb
rake_docker-2.14.0.pre.2 lib/rake_docker/tasks/tag.rb
rake_docker-2.14.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.13.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.12.0.pre.2 lib/rake_docker/tasks/tag.rb
rake_docker-2.12.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.11.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.10.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.9.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.8.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.7.0 lib/rake_docker/tasks/tag.rb
rake_docker-2.6.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-2.5.0 lib/rake_docker/tasks/tag.rb