Ability to specify a container entry point

This commit is contained in:
Nikola Petkanski
2024-07-12 16:30:49 +03:00
parent a24f1d59b9
commit 90a8d4dc28
+14
View File
@@ -17,6 +17,8 @@ class Container
{
private string $id;
private ?string $entryPoint = null;
/**
* @var array<string, string>
*/
@@ -54,6 +56,13 @@ class Container
return new Container($image);
}
public function withEntryPoint(string $entryPoint): self
{
$this->entryPoint = $entryPoint;
return $this;
}
public function withEnvironment(string $name, string $value): self
{
$this->env[$name] = $value;
@@ -138,6 +147,11 @@ class Container
$params[] = $this->network;
}
if ($this->entryPoint !== null) {
$params[] = '--entrypoint';
$params[] = $this->entryPoint;
}
$params[] = $this->image;
$this->process = new Process($params);