Class: Ufo::Docker::Pusher
- Inherits:
-
Object
- Object
- Ufo::Docker::Pusher
show all
- Includes:
- Concerns
- Defined in:
- lib/ufo/docker/pusher.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#pretty_home, #pretty_path, #pretty_time
#logger
#execute, #user_params
Constructor Details
#initialize(image, options) ⇒ Pusher
7
8
9
10
11
12
|
# File 'lib/ufo/docker/pusher.rb', line 7
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.
6
7
8
|
# File 'lib/ufo/docker/pusher.rb', line 6
def last_image_name
@last_image_name
end
|
Instance Method Details
#builder ⇒ Object
29
30
31
|
# File 'lib/ufo/docker/pusher.rb', line 29
def builder
@builder ||= Builder.new(@options.merge(image: last_image_name))
end
|
#push ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/ufo/docker/pusher.rb', line 14
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 = execute(command, log: log)
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
33
34
35
36
37
|
# File 'lib/ufo/docker/pusher.rb', line 33
def update_auth_token
auth = Ufo::Ecr::Auth.new(last_image_name)
auth.update
end
|