Merge branch 'main' into dockerfile-context-build-options

This commit is contained in:
Samuel Sieg
2023-03-09 08:54:23 +01:00
17 changed files with 250 additions and 20 deletions

View File

@@ -2,7 +2,7 @@ class Mrsk::Commands::Registry < Mrsk::Commands::Base
delegate :registry, to: :config
def login
docker :login, registry["server"], "-u", redact(registry["username"]), "-p", redact(lookup_password)
docker :login, registry["server"], "-u", redact(lookup("username")), "-p", redact(lookup("password"))
end
def logout
@@ -10,11 +10,11 @@ class Mrsk::Commands::Registry < Mrsk::Commands::Base
end
private
def lookup_password
if registry["password"].is_a?(Array)
ENV.fetch(registry["password"].first).dup
def lookup(key)
if registry[key].is_a?(Array)
ENV.fetch(registry[key].first).dup
else
registry["password"]
registry[key]
end
end
end

View File

@@ -4,7 +4,7 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
"--detach",
"--restart", "unless-stopped",
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
"--publish", "80:80",
"--publish", port,
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
"traefik",
"--providers.docker",
@@ -45,6 +45,10 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
docker :image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=Traefik"
end
def port
"#{config.raw_config.traefik.fetch("host_port", "80")}:80"
end
private
def cmd_args
(config.raw_config.dig(:traefik, "args") || { }).collect { |(key, value)| [ "--#{key}", value ] }.flatten