mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 17:29:29 +00:00
Ability to specify a container entry point
This commit is contained in:
@@ -17,6 +17,8 @@ class Container
|
|||||||
{
|
{
|
||||||
private string $id;
|
private string $id;
|
||||||
|
|
||||||
|
private ?string $entryPoint = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
@@ -54,6 +56,13 @@ class Container
|
|||||||
return new Container($image);
|
return new Container($image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withEntryPoint(string $entryPoint): self
|
||||||
|
{
|
||||||
|
$this->entryPoint = $entryPoint;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function withEnvironment(string $name, string $value): self
|
public function withEnvironment(string $name, string $value): self
|
||||||
{
|
{
|
||||||
$this->env[$name] = $value;
|
$this->env[$name] = $value;
|
||||||
@@ -138,6 +147,11 @@ class Container
|
|||||||
$params[] = $this->network;
|
$params[] = $this->network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->entryPoint !== null) {
|
||||||
|
$params[] = '--entrypoint';
|
||||||
|
$params[] = $this->entryPoint;
|
||||||
|
}
|
||||||
|
|
||||||
$params[] = $this->image;
|
$params[] = $this->image;
|
||||||
|
|
||||||
$this->process = new Process($params);
|
$this->process = new Process($params);
|
||||||
|
|||||||
Reference in New Issue
Block a user