Mount secrets into containers

This commit is contained in:
Roberto Alsina 2024-07-02 13:01:07 -03:00
parent 4371444fa4
commit d506a7250a

View File

@ -161,12 +161,21 @@ class Funko
# Create a container for this funko # Create a container for this funko
def create_container(autostart : Bool = true) : String def create_container(autostart : Bool = true) : String
secrets_mount = "#{Dir.current}/secrets/#{name}"
Dir.mkdir_p(secrets_mount)
conf = Docr::Types::CreateContainerConfig.new( conf = Docr::Types::CreateContainerConfig.new(
image: "#{name}:latest", image: "#{name}:latest",
hostname: name, hostname: name,
# Port in the container side # Port in the container side
host_config: Docr::Types::HostConfig.new( host_config: Docr::Types::HostConfig.new(
network_mode: "faaso-net", network_mode: "faaso-net",
mounts: [
Docr::Types::Mount.new(
source: secrets_mount,
target: "/secrets",
type: "bind"
)
]
) )
) )