Class: Kamal::Commands::Builder::Base
Defined Under Namespace
Classes: BuilderError
Constant Summary
Kamal::Commands::Base::DOCKER_HEALTH_LOG_FORMAT, Kamal::Commands::Base::DOCKER_HEALTH_STATUS_FORMAT
Instance Attribute Summary
#config
Instance Method Summary
collapse
#container_id_for, #initialize, #make_directory, #make_directory_for, #remove_directory, #run_over_ssh
Instance Method Details
#build_context ⇒ Object
30
31
32
|
# File 'lib/kamal/commands/builder/base.rb', line 30
def build_context
config.builder.context
end
|
#build_options ⇒ Object
26
27
28
|
# File 'lib/kamal/commands/builder/base.rb', line 26
def build_options
[ *build_tags, *build_cache, *build_labels, *build_args, *build_secrets, *build_dockerfile, *build_ssh ]
end
|
#clean ⇒ Object
8
9
10
|
# File 'lib/kamal/commands/builder/base.rb', line 8
def clean
docker :image, :rm, "--force", config.absolute_image
end
|
#pull ⇒ Object
12
13
14
|
# File 'lib/kamal/commands/builder/base.rb', line 12
def pull
docker :pull, config.absolute_image
end
|
#push ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/kamal/commands/builder/base.rb', line 16
def push
if git_archive?
pipe \
git(:archive, "--format=tar", :HEAD),
build_and_push
else
build_and_push
end
end
|
#validate_image ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/kamal/commands/builder/base.rb', line 34
def validate_image
pipe \
docker(:inspect, "-f", "'{{ .Config.Labels.service }}'", config.absolute_image),
any(
[ :grep, "-x", config.service ],
"(echo \"Image #{config.absolute_image} is missing the 'service' label\" && exit 1)"
)
end
|