Skip to content

Commit

Permalink
Login before pushing image
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Dec 29, 2018
1 parent 65503cc commit 7cfe452
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -115,6 +115,7 @@ namespace :docker do
)

manager.build
manager.login
manager.push
end

Expand Down
34 changes: 17 additions & 17 deletions docker/manager.rb
Expand Up @@ -34,6 +34,21 @@ def initialize(version:, line_editor:, compiler:)
@compiler = compiler
end

def login
print "Logging in to dockerhub... "

login_cmd = %W[
docker
login
-u
#{ENV['DOCKER_USER']}
-p
#{ENV['DOCKER_PASS']}
]

run(*login_cmd)
end

def build
command = <<-COMMAND
docker build \
Expand Down Expand Up @@ -119,21 +134,6 @@ def run(*command)

private

def login
print "Logging in to dockerhub... "

login_cmd = %W[
docker
login
-u
#{ENV['DOCKER_USER']}
-p
#{ENV['DOCKER_PASS']}
]

run(*login_cmd)
end

def releases_url
"https://raw.githubusercontent.com/ruby/www.ruby-lang.org/master/_data/releases.yml"
end
Expand Down Expand Up @@ -196,8 +196,8 @@ def download_sha256
version_info["sha256"]["xz"]
end

def run(command)
self.class.run(command)
def run(*command)
self.class.run(*command)
end

def tag
Expand Down

0 comments on commit 7cfe452

Please sign in to comment.