Extract echo_boot_config/docker_run methods

This commit is contained in:
Donal McBreen
2025-04-15 12:04:06 +01:00
parent c3a9a3c1eb
commit c9a755bde6

View File

@@ -2,14 +2,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
delegate :argumentize, :optionize, to: Kamal::Utils
def run
pipe \
[ :echo, "\$\(#{get_boot_options.join(" ")}\) #{config.proxy_image}" ],
xargs(docker(:run,
"--name", container_name,
"--network", "kamal",
"--detach",
"--restart", "unless-stopped",
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy"))
pipe echo_boot_config, xargs(docker_run)
end
def start
@@ -84,4 +77,18 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
def container_name
config.proxy_container_name
end
def echo_boot_config
[ :echo, "\$\(#{get_boot_options.join(" ")}\) #{config.proxy_image}" ]
end
def docker_run
docker \
:run,
"--name", container_name,
"--network", "kamal",
"--detach",
"--restart", "unless-stopped",
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy"
end
end