Class: Dockerploy::Image
- Inherits:
-
Object
- Object
- Dockerploy::Image
- Defined in:
- lib/dockerploy/image.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(config, options = {}) ⇒ Image
constructor
A new instance of Image.
- #pull ⇒ Object
- #push ⇒ Object
Constructor Details
#initialize(config, options = {}) ⇒ Image
Returns a new instance of Image.
3 4 5 6 |
# File 'lib/dockerploy/image.rb', line 3 def initialize(config, = {}) @config = config = end |
Instance Method Details
#build ⇒ Object
8 9 10 11 |
# File 'lib/dockerploy/image.rb', line 8 def build command = sprintf('env DOCKER_HOST=%s docker build -t %s .', @config.docker_host, image_name) ShellClient.new.command(command) end |
#pull ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/dockerploy/image.rb', line 18 def pull return unless @config.servers @config.servers.each do |server| ssh_client = SSHClient.new(server[:host], server[:username], server[:password], server[:port]) ssh_client.command(sprintf('docker pull %s', image_name)) end end |
#push ⇒ Object
13 14 15 16 |
# File 'lib/dockerploy/image.rb', line 13 def push command = sprintf('env DOCKER_HOST=%s docker push %s', @config.docker_host, image_name) ShellClient.new.command(command) end |