Namespace buildx and contexts
To prevent clashes on remote builders
This commit is contained in:
@@ -2,11 +2,11 @@ require "mrsk/commands/base"
|
|||||||
|
|
||||||
class Mrsk::Commands::Builder::Multiarch < Mrsk::Commands::Base
|
class Mrsk::Commands::Builder::Multiarch < Mrsk::Commands::Base
|
||||||
def create
|
def create
|
||||||
docker :buildx, :create, "--use", "--name", "mrsk"
|
docker :buildx, :create, "--use", "--name", builder_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove
|
def remove
|
||||||
docker :buildx, :rm, "mrsk"
|
docker :buildx, :rm, builder_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def push
|
def push
|
||||||
@@ -22,4 +22,9 @@ class Mrsk::Commands::Builder::Multiarch < Mrsk::Commands::Base
|
|||||||
docker(:context, :ls),
|
docker(:context, :ls),
|
||||||
docker(:buildx, :ls)
|
docker(:buildx, :ls)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def builder_name
|
||||||
|
"mrsk-#{config.service}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ class Mrsk::Commands::Builder::Multiarch::Remote < Mrsk::Commands::Builder::Mult
|
|||||||
|
|
||||||
private
|
private
|
||||||
def create_local_buildx
|
def create_local_buildx
|
||||||
docker :buildx, :create, "--use", "--name", "mrsk", "mrsk-#{local["arch"]}", "--platform", "linux/#{local["arch"]}"
|
docker :buildx, :create, "--use", "--name", builder_name, builder_name_with_arch(local["arch"]), "--platform", "linux/#{local["arch"]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def append_remote_buildx
|
def append_remote_buildx
|
||||||
docker :buildx, :create, "--append", "--name", "mrsk", "mrsk-#{remote["arch"]}", "--platform", "linux/#{remote["arch"]}"
|
docker :buildx, :create, "--append", "--name", builder_name, builder_name_with_arch(remote["arch"]), "--platform", "linux/#{remote["arch"]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_contexts
|
def create_contexts
|
||||||
@@ -30,7 +30,7 @@ class Mrsk::Commands::Builder::Multiarch::Remote < Mrsk::Commands::Builder::Mult
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_context(arch, host)
|
def create_context(arch, host)
|
||||||
docker :context, :create, "mrsk-#{arch}", "--description", "'MRSK #{arch} Native Host'", "--docker", "'host=#{host}'"
|
docker :context, :create, builder_name_with_arch(arch), "--description", "'#{builder_name} #{arch} native host'", "--docker", "'host=#{host}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_contexts
|
def remove_contexts
|
||||||
@@ -40,7 +40,7 @@ class Mrsk::Commands::Builder::Multiarch::Remote < Mrsk::Commands::Builder::Mult
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remove_context(arch)
|
def remove_context(arch)
|
||||||
docker :context, :rm, "mrsk-#{arch}"
|
docker :context, :rm, builder_name_with_arch(arch)
|
||||||
end
|
end
|
||||||
|
|
||||||
def local
|
def local
|
||||||
@@ -50,4 +50,9 @@ class Mrsk::Commands::Builder::Multiarch::Remote < Mrsk::Commands::Builder::Mult
|
|||||||
def remote
|
def remote
|
||||||
config.builder["remote"]
|
config.builder["remote"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def builder_name_with_arch(arch)
|
||||||
|
"#{builder_name}-#{arch}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user