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 7d5fe76
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Orchestration/Adapter/DockerSSH.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Utopia\Orchestration\Adapter;

use Utopia\CLI\Console;
use Utopia\Orchestration\Adapter\DockerCLI;
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 7d5fe76

Please sign in to comment.