Class: Ufo::Docker::Pusher
Instance Attribute Summary collapse
Instance Method Summary
collapse
#run_hooks
Methods included from Concerns
#build, #deploy, #info, #ps
#names
Constructor Details
#initialize(image, options) ⇒ Pusher
Returns a new instance of Pusher.
8
9
10
11
12
13
|
# File 'lib/ufo/docker/pusher.rb', line 8
def initialize(image, options)
@options = options
@last_image_name = image || docker_image
end
|
Instance Attribute Details
#last_image_name ⇒ Object
Returns the value of attribute last_image_name.
7
8
9
|
# File 'lib/ufo/docker/pusher.rb', line 7
def last_image_name
@last_image_name
end
|
Instance Method Details
#builder ⇒ Object
33
34
35
|
# File 'lib/ufo/docker/pusher.rb', line 33
def builder
@builder ||= Builder.new(@options.merge(image: last_image_name))
end
|
#push ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ufo/docker/pusher.rb', line 15
def push
update_auth_token
start_time = Time.now
logger.info "Pushing Docker Image"
command = "docker push #{last_image_name}"
log = ".ufo/log/docker.log" if @options[:quiet]
success = nil
run_hooks(name: "push", file: "docker.rb") do
success = execute(command, log: log)
end
unless success
logger.info "ERROR: The docker image fail to push.".color(:red)
exit 1
end
took = Time.now - start_time
logger.info "Took #{pretty_time(took)}"
end
|
#update_auth_token ⇒ Object
37
38
39
40
41
|
# File 'lib/ufo/docker/pusher.rb', line 37
def update_auth_token
auth = Ufo::Ecr::Auth.new(last_image_name)
auth.update
end
|