Add local/remote builder combo for multiarch

This commit is contained in:
David Heinemeier Hansson
2023-01-12 21:35:31 +01:00
parent 5afadb10ca
commit 2257c99189
3 changed files with 89 additions and 1 deletions

View File

@@ -5,6 +5,10 @@ class Mrsk::Commands::Builder < Mrsk::Commands::Base
docker :buildx, :create, "--use", "--name", "mrsk"
end
def remove
docker :buildx, :rm, "mrsk"
end
def push
docker :buildx, :build, "--push", "--platform linux/amd64,linux/arm64", "-t", config.absolute_image, "."
end
@@ -12,4 +16,22 @@ class Mrsk::Commands::Builder < Mrsk::Commands::Base
def pull
docker :pull, config.absolute_image
end
def create_context(arch, host)
docker :context, :create, "mrsk-#{arch}", "--description", "'MRSK #{arch} Native Host'", "--docker", "'host=#{host}'"
end
def remove_context(arch)
docker :context, :rm, "mrsk-#{arch}"
end
def create_with_context(arch)
docker :buildx, :create, "--use", "--name", "mrsk", "mrsk-#{arch}"
end
def append_context(arch)
docker :buildx, :create, "--append", "--name", "mrsk", "mrsk-#{arch}"
end
end

View File

@@ -3,7 +3,7 @@ require "active_support/core_ext/string/inquiry"
require "erb"
class Mrsk::Configuration
delegate :service, :image, :servers, :env, :labels, :registry, to: :config, allow_nil: true
delegate :service, :image, :servers, :env, :labels, :registry, :builder, to: :config, allow_nil: true
class << self
def load_file(file)