Merge pull request #77 from calmyournerves/dockerfile-context-build-options
Allow setting the Dockerfile and the Docker build context when building
This commit is contained in:
@@ -10,7 +10,11 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
|
||||
end
|
||||
|
||||
def build_options
|
||||
[ *build_tags, *build_labels, *build_args, *build_secrets ]
|
||||
[ *build_tags, *build_labels, *build_args, *build_secrets, *build_dockerfile ]
|
||||
end
|
||||
|
||||
def build_context
|
||||
context
|
||||
end
|
||||
|
||||
private
|
||||
@@ -30,6 +34,10 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
|
||||
argumentize "--secret", secrets.collect { |secret| [ "id", secret ] }
|
||||
end
|
||||
|
||||
def build_dockerfile
|
||||
argumentize "--file", dockerfile
|
||||
end
|
||||
|
||||
def args
|
||||
(config.builder && config.builder["args"]) || {}
|
||||
end
|
||||
@@ -37,4 +45,12 @@ class Mrsk::Commands::Builder::Base < Mrsk::Commands::Base
|
||||
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
|
||||
|
||||
@@ -13,7 +13,7 @@ class Mrsk::Commands::Builder::Multiarch < Mrsk::Commands::Builder::Base
|
||||
"--platform", "linux/amd64,linux/arm64",
|
||||
"--builder", builder_name,
|
||||
*build_options,
|
||||
"."
|
||||
build_context
|
||||
end
|
||||
|
||||
def info
|
||||
|
||||
@@ -9,7 +9,7 @@ class Mrsk::Commands::Builder::Native < Mrsk::Commands::Builder::Base
|
||||
|
||||
def push
|
||||
combine \
|
||||
docker(:build, *build_options, "."),
|
||||
docker(:build, *build_options, build_context),
|
||||
docker(:push, config.absolute_image)
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Mrsk::Commands::Builder::Native::Remote < Mrsk::Commands::Builder::Native
|
||||
"--platform", platform,
|
||||
"--builder", builder_name,
|
||||
*build_options,
|
||||
"."
|
||||
build_context
|
||||
end
|
||||
|
||||
def info
|
||||
|
||||
Reference in New Issue
Block a user