mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 16:29:29 +00:00
Merge pull request #10 from dinamic/feature/custom-entrypoint
Ability to specify a container entry point
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user