Class: Kamal::Commands::Builder::Base
Defined Under Namespace
Classes: BuilderError
Constant Summary
collapse
- ENDPOINT_DOCKER_HOST_INSPECT =
"'{{.Endpoints.docker.Host}}'"
Kamal::Commands::Base::DOCKER_HEALTH_STATUS_FORMAT
Instance Attribute Summary
#config
Instance Method Summary
collapse
#container_id_for, #ensure_docker_installed, #initialize, #make_directory, #make_directory_for, #remove_directory, #remove_file, #run_over_ssh
Instance Method Details
#build_context ⇒ Object
44
45
46
|
# File 'lib/kamal/commands/builder/base.rb', line 44
def build_context
config.builder.context
end
|
#build_options ⇒ Object
40
41
42
|
# File 'lib/kamal/commands/builder/base.rb', line 40
def build_options
[ *build_cache, *build_labels, *build_args, *build_secrets, *build_dockerfile, *build_target, *build_ssh, *builder_provenance, *builder_sbom ]
end
|
#clean ⇒ Object
12
13
14
|
# File 'lib/kamal/commands/builder/base.rb', line 12
def clean
docker :image, :rm, "--force", config.absolute_image
end
|
#first_mirror ⇒ Object
57
58
59
|
# File 'lib/kamal/commands/builder/base.rb', line 57
def first_mirror
docker(:info, "--format '{{index .RegistryConfig.Mirrors 0}}'")
end
|
#info ⇒ Object
30
31
32
33
34
|
# File 'lib/kamal/commands/builder/base.rb', line 30
def info
combine \
docker(:context, :ls),
docker(:buildx, :ls)
end
|
#inspect_builder ⇒ Object
36
37
38
|
# File 'lib/kamal/commands/builder/base.rb', line 36
def inspect_builder
docker :buildx, :inspect, builder_name unless docker_driver?
end
|
#pull ⇒ Object
26
27
28
|
# File 'lib/kamal/commands/builder/base.rb', line 26
def pull
docker :pull, config.absolute_image
end
|
#push(export_action = "registry", tag_as_dirty: false) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/kamal/commands/builder/base.rb', line 16
def push(export_action = "registry", tag_as_dirty: false)
docker :buildx, :build,
"--output=type=#{export_action}",
*platform_options(arches),
*([ "--builder", builder_name ] unless docker_driver?),
*build_tag_options(tag_as_dirty: tag_as_dirty),
*build_options,
build_context
end
|
#validate_image ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/kamal/commands/builder/base.rb', line 48
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
|