Added support for multistage build cache
This commit is contained in:
@@ -13,11 +13,11 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
|
||||
end
|
||||
|
||||
def build_options
|
||||
[ *build_tags, *build_labels, *build_args, *build_secrets, *build_dockerfile ]
|
||||
[ *build_tags, *build_cache, *build_labels, *build_args, *build_secrets, *build_dockerfile ]
|
||||
end
|
||||
|
||||
def build_context
|
||||
context
|
||||
config.builder.context
|
||||
end
|
||||
|
||||
|
||||
@@ -26,39 +26,30 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
|
||||
[ "-t", config.absolute_image, "-t", config.latest_image ]
|
||||
end
|
||||
|
||||
def build_cache
|
||||
if config.builder.cache?
|
||||
["--cache-to", config.builder.cache_to,
|
||||
"--cache-from", config.builder.cache_from]
|
||||
end
|
||||
end
|
||||
|
||||
def build_labels
|
||||
argumentize "--label", { service: config.service }
|
||||
end
|
||||
|
||||
def build_args
|
||||
argumentize "--build-arg", args, sensitive: true
|
||||
argumentize "--build-arg", config.builder.args, sensitive: true
|
||||
end
|
||||
|
||||
def build_secrets
|
||||
argumentize "--secret", secrets.collect { |secret| [ "id", secret ] }
|
||||
argumentize "--secret", config.builder.secrets.collect { |secret| [ "id", secret ] }
|
||||
end
|
||||
|
||||
def build_dockerfile
|
||||
if Pathname.new(File.expand_path(dockerfile)).exist?
|
||||
argumentize "--file", dockerfile
|
||||
if Pathname.new(File.expand_path(config.builder.dockerfile)).exist?
|
||||
argumentize "--file", config.builder.dockerfile
|
||||
else
|
||||
raise BuilderError, "Missing #{dockerfile}"
|
||||
raise BuilderError, "Missing #{config.builder.dockerfile}"
|
||||
end
|
||||
end
|
||||
|
||||
def args
|
||||
(config.builder && config.builder["args"]) || {}
|
||||
end
|
||||
|
||||
def secrets
|
||||
(config.builder && config.builder["secrets"]) || []
|
||||
end
|
||||
|
||||
def dockerfile
|
||||
(config.builder && config.builder["dockerfile"]) || "Dockerfile"
|
||||
end
|
||||
|
||||
def context
|
||||
(config.builder && config.builder["context"]) || "."
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user