Allow Traefik to run without publishing port

Adds the `publish` option which, if set to false, does not pass `--publish` to
`docker run` when starting Traefik. This is useful when running Traefik
behind a reverse proxy, for example.
This commit is contained in:
Trevor Vallender
2023-08-24 10:52:10 +01:00
parent 519659b84c
commit c2ec04f8c1
2 changed files with 10 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ class Kamal::Commands::Traefik < Kamal::Commands::Base
docker :run, "--name traefik",
"--detach",
"--restart", "unless-stopped",
"--publish", port,
*publish_args,
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
*env_args,
*config.logging_args,
@@ -64,6 +64,10 @@ class Kamal::Commands::Traefik < Kamal::Commands::Base
end
private
def publish_args
argumentize "--publish", port unless config.traefik["publish"] == false
end
def label_args
argumentize "--label", labels
end