Class: Kamal::Commands::Registry

Inherits:
Base
  • Object
show all
Defined in:
lib/kamal/commands/registry.rb

Constant Summary

Constants inherited from Base

Base::DOCKER_HEALTH_STATUS_FORMAT

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#container_id_for, #ensure_docker_installed, #initialize, #make_directory, #make_directory_for, #remove_directory, #remove_file, #run_over_ssh

Constructor Details

This class inherits a constructor from Kamal::Commands::Base

Instance Method Details

#local?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/kamal/commands/registry.rb', line 35

def local?
  config.registry.local?
end

#login(registry_config: nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/kamal/commands/registry.rb', line 2

def (registry_config: nil)
  registry_config ||= config.registry

  return if registry_config.local?

  docker :login,
    registry_config.server,
    "-u", sensitive(Kamal::Utils.escape_shell_value(registry_config.username)),
    "-p", sensitive(Kamal::Utils.escape_shell_value(registry_config.password))
end

#logout(registry_config: nil) ⇒ Object



13
14
15
16
17
# File 'lib/kamal/commands/registry.rb', line 13

def logout(registry_config: nil)
  registry_config ||= config.registry

  docker :logout, registry_config.server
end

#removeObject



28
29
30
31
32
33
# File 'lib/kamal/commands/registry.rb', line 28

def remove
  combine \
    docker(:stop, "kamal-docker-registry"),
    docker(:rm, "kamal-docker-registry"),
    by: "&&"
end

#setup(registry_config: nil) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/kamal/commands/registry.rb', line 19

def setup(registry_config: nil)
  registry_config ||= config.registry

  combine \
    docker(:start, "kamal-docker-registry"),
    docker(:run, "--detach", "-p", "127.0.0.1:#{registry_config.local_port}:5000", "--name", "kamal-docker-registry", "registry:3"),
    by: "||"
end