Class: KuberKit::Shell::Commands::DockerComposeCommands

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/shell/commands/docker_compose_commands.rb

Instance Method Summary collapse

Instance Method Details

#run(shell, path, service:, command:, interactive: false, detached: false) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kuber_kit/shell/commands/docker_compose_commands.rb', line 2

def run(shell, path, service:, command:, interactive: false, detached: false)
  command_parts = [
    "docker-compose",
    "run",
    "-f #{path}",
  ]
  
  if detached
    command_parts << "-d"
  end

  command_parts << service
  command_parts << command
  
  if interactive
    shell.interactive!(command_parts.join(" "))
  else
    shell.exec!(command_parts.join(" "))
  end
end