Dump native builder
We already ensure that buildx is installed, so let's always use it.
This commit is contained in:
@@ -13,7 +13,7 @@ class Kamal::Commands::Builder < Kamal::Commands::Base
|
||||
def target
|
||||
case
|
||||
when !config.builder.multiarch? && !config.builder.cached?
|
||||
native
|
||||
local
|
||||
when !config.builder.multiarch? && config.builder.cached?
|
||||
local
|
||||
when config.builder.local? && config.builder.remote?
|
||||
@@ -25,10 +25,6 @@ class Kamal::Commands::Builder < Kamal::Commands::Base
|
||||
end
|
||||
end
|
||||
|
||||
def native
|
||||
@native ||= Kamal::Commands::Builder::Native.new(config)
|
||||
end
|
||||
|
||||
def remote
|
||||
@remote ||= Kamal::Commands::Builder::Remote.new(config)
|
||||
end
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
class Kamal::Commands::Builder::Native < Kamal::Commands::Builder::Base
|
||||
def create
|
||||
# No-op on native without cache
|
||||
end
|
||||
|
||||
def remove
|
||||
# No-op on native without cache
|
||||
end
|
||||
|
||||
def info
|
||||
# No-op on native
|
||||
end
|
||||
|
||||
def push
|
||||
combine \
|
||||
docker(:build, *build_options, build_context),
|
||||
docker(:push, config.absolute_image),
|
||||
docker(:push, config.latest_image)
|
||||
end
|
||||
end
|
||||
@@ -15,9 +15,9 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
||||
|
||||
test "target native when multiarch is off" do
|
||||
builder = new_builder_command(builder: { "multiarch" => false })
|
||||
assert_equal "native", builder.name
|
||||
assert_equal "local", builder.name
|
||||
assert_equal \
|
||||
"docker build -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --file Dockerfile . && docker push dhh/app:123 && docker push dhh/app:latest",
|
||||
"docker buildx build --push --builder kamal-local -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --file Dockerfile .",
|
||||
builder.push.join(" ")
|
||||
end
|
||||
|
||||
@@ -100,7 +100,7 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
||||
test "native push with build args" do
|
||||
builder = new_builder_command(builder: { "multiarch" => false, "args" => { "a" => 1, "b" => 2 } })
|
||||
assert_equal \
|
||||
"docker build -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --build-arg a=\"1\" --build-arg b=\"2\" --file Dockerfile . && docker push dhh/app:123 && docker push dhh/app:latest",
|
||||
"docker buildx build --push --builder kamal-local -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --build-arg a=\"1\" --build-arg b=\"2\" --file Dockerfile .",
|
||||
builder.push.join(" ")
|
||||
end
|
||||
|
||||
@@ -114,7 +114,7 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
||||
test "native push with build secrets" do
|
||||
builder = new_builder_command(builder: { "multiarch" => false, "secrets" => [ "a", "b" ] })
|
||||
assert_equal \
|
||||
"docker build -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --secret id=\"a\" --secret id=\"b\" --file Dockerfile . && docker push dhh/app:123 && docker push dhh/app:latest",
|
||||
"docker buildx build --push --builder kamal-local -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --secret id=\"a\" --secret id=\"b\" --file Dockerfile .",
|
||||
builder.push.join(" ")
|
||||
end
|
||||
|
||||
@@ -140,7 +140,7 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
||||
test "native context build" do
|
||||
builder = new_builder_command(builder: { "multiarch" => false, "context" => "./foo" })
|
||||
assert_equal \
|
||||
"docker build -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --file Dockerfile ./foo && docker push dhh/app:123 && docker push dhh/app:latest",
|
||||
"docker buildx build --push --builder kamal-local -t dhh/app:123 -t dhh/app:latest --label service=\"app\" --file Dockerfile ./foo",
|
||||
builder.push.join(" ")
|
||||
end
|
||||
|
||||
@@ -166,7 +166,7 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
||||
|
||||
test "native context hosts" do
|
||||
command = new_builder_command(builder: { "multiarch" => false })
|
||||
assert_equal :true, command.context_hosts
|
||||
assert_equal "docker buildx inspect kamal-local > /dev/null", command.context_hosts.join(" ")
|
||||
assert_equal "", command.config_context_hosts.join(" ")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user