Skip to content

Commit

Permalink
Merge pull request #10 from dinamic/feature/custom-entrypoint
Browse files Browse the repository at this point in the history
Ability to specify a container entry point
  • Loading branch information
shyim authored Jul 13, 2024
2 parents a24f1d5 + 90a8d4d commit 1b15815
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Container
{
private string $id;

private ?string $entryPoint = null;

/**
* @var array<string, string>
*/
Expand Down Expand Up @@ -54,6 +56,13 @@ public static function make(string $image): self
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;
Expand Down Expand Up @@ -138,6 +147,11 @@ public function run(bool $wait = true): self
$params[] = $this->network;
}

if ($this->entryPoint !== null) {
$params[] = '--entrypoint';
$params[] = $this->entryPoint;
}

$params[] = $this->image;

$this->process = new Process($params);
Expand Down

0 comments on commit 1b15815

Please sign in to comment.