Class: Afterlife::Deploy::DockerDeployment::AwsAuth
- Inherits:
-
Object
- Object
- Afterlife::Deploy::DockerDeployment::AwsAuth
- Defined in:
- lib/afterlife/deploy/docker_deployment.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #aws_ecr_token ⇒ Object
- #commands ⇒ Object
- #docker_login ⇒ Object
-
#initialize(registry) ⇒ AwsAuth
constructor
A new instance of AwsAuth.
- #region ⇒ Object
Constructor Details
#initialize(registry) ⇒ AwsAuth
Returns a new instance of AwsAuth.
79 80 81 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 79 def initialize(registry) @registry = registry end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
77 78 79 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 77 def registry @registry end |
Instance Method Details
#aws_ecr_token ⇒ Object
93 94 95 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 93 def aws_ecr_token @aws_ecr_token ||= Exec.result("aws ecr get-login-password --region #{region}") end |
#commands ⇒ Object
83 84 85 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 83 def commands [docker_login] end |
#docker_login ⇒ Object
87 88 89 90 91 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 87 def docker_login <<-BASH echo "#{aws_ecr_token}" | docker login --username AWS --password-stdin #{registry} BASH end |
#region ⇒ Object
97 98 99 |
# File 'lib/afterlife/deploy/docker_deployment.rb', line 97 def region @region ||= registry.gsub(/[^.]+\.dkr\.ecr\.([^.]+)\.amazonaws\.com/, '\1') end |