Allow disabling of local builds
To disable local builds set: ``` builder: local: false remote: ssh://docker@docker-builder ```
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -30,6 +30,11 @@ builder:
|
||||
# If you have a remote builder, you can configure it here
|
||||
remote: ssh://docker@docker-builder
|
||||
|
||||
# Whether to allow local builds
|
||||
#
|
||||
# Defaults to true
|
||||
local: true
|
||||
|
||||
# Builder cache
|
||||
#
|
||||
# The type must be either 'gha' or 'registry'
|
||||
|
||||
@@ -7,5 +7,7 @@ class Kamal::Configuration::Validator::Builder < Kamal::Configuration::Validator
|
||||
end
|
||||
|
||||
error "Builder arch not set" unless config["arch"].present?
|
||||
|
||||
error "Cannot disable local builds, no remote is set" if config["local"] == false && config["remote"].blank?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user