Sha256: cc052397db1401873028d77662681ae86ade17e67358eda3cd0ff64887a45983

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module ContainerShip
  module Command
    module Modules
      module Docker
        def push_image(task_definition)
          sh "docker build -t \"#{task_definition.image_name}:#{task_definition.build_number}\" ."
          sh "docker push #{task_definition.image_name}:#{task_definition.build_number}"
        end

        private

        def sh(command)
          puts command

          status = nil
          Open3.popen3(command) do |_stdin, stdout, stderr, wait_thr|
            Thread.new(stdout) { |io| io.each { puts _1 } }
            Thread.new(stderr) { |io| io.each { puts _1 } }

            status = wait_thr.value
          end
          exit(status.exitstatus) unless status.success?
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
container_ship-0.1.6 lib/container_ship/command/modules/docker.rb