Skip to content

Commit

Permalink
feat: add DockerSSH adapter using a 'docker context'
Browse files Browse the repository at this point in the history
  • Loading branch information
basert committed Sep 19, 2024
1 parent 331b831 commit abd1797
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Orchestration/Adapter/DockerSSH.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Utopia\Orchestration\Adapter;

use Utopia\CLI\Console;
use Utopia\Orchestration\Exception\Orchestration;

class DockerSSH extends DockerCLI
{
/**
* Constructor
*
* @return void
*/
public function __construct(string $sshHost, string $sshUser)
{
$output = '';
if (! Console::execute("docker context create --docker host=ssh://{$sshUser}@{$sshHost} ssh", '', $output)) {
throw new Orchestration("Docker Error: {$output}");
}
$output = '';
if (! Console::execute('docker context use ssh', '', $output)) {
throw new Orchestration("Docker Error: {$output}");
}
}
}

0 comments on commit abd1797

Please sign in to comment.