Allow disabling of local builds

To disable local builds set:
```
builder:
   local: false
   remote: ssh://docker@docker-builder
```
This commit is contained in:
Donal McBreen
2024-09-03 14:33:25 +01:00
parent 9b9e60ec7f
commit a2549b1f60
5 changed files with 40 additions and 2 deletions

View File

@@ -28,7 +28,9 @@ class Kamal::Configuration::Builder
end
def local_arches
@local_arches ||= if remote
@local_arches ||= if local_disabled?
[]
elsif remote
arches & [ Kamal::Utils.docker_arch ]
else
arches
@@ -48,7 +50,7 @@ class Kamal::Configuration::Builder
end
def local?
arches.empty? || local_arches.any?
!local_disabled? && (arches.empty? || local_arches.any?)
end
def cached?
@@ -79,6 +81,10 @@ class Kamal::Configuration::Builder
builder_config.fetch("driver", "docker-container")
end
def local_disabled?
builder_config["local"] == false
end
def cache_from
if cached?
case builder_config["cache"]["type"]