Sha256: 6d7817a6bec8450b6001b61c3cad009b36b74f4f4a112a7e13a15edb77939ea6

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

require 'rake_factory'
require 'docker'

module RakeDocker
  module Tasks
    class Tag < RakeFactory::Task
      default_name :tag
      default_description ->(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

5 entries across 5 versions & 1 rubygems

Version Path
rake_docker-1.3.0 lib/rake_docker/tasks/tag.rb
rake_docker-1.2.0.pre.1 lib/rake_docker/tasks/tag.rb
rake_docker-1.1.0 lib/rake_docker/tasks/tag.rb
rake_docker-1.0.0.pre.pre.2 lib/rake_docker/tasks/tag.rb
rake_docker-0.24.0.pre.1 lib/rake_docker/tasks/tag.rb