From 90a8d4dc2892ccfa5e5510b8a9cff584a407808b Mon Sep 17 00:00:00 2001 From: Nikola Petkanski Date: Fri, 12 Jul 2024 16:30:49 +0300 Subject: [PATCH] Ability to specify a container entry point --- src/Container/Container.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Container/Container.php b/src/Container/Container.php index 9e92bf7..1317383 100644 --- a/src/Container/Container.php +++ b/src/Container/Container.php @@ -17,6 +17,8 @@ class Container { private string $id; + private ?string $entryPoint = null; + /** * @var array */ @@ -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; @@ -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);