Added self-updating, better docker-compose control
* Added --self-update to check for and download new versions of the phar * Added --only option which accepts a comma-separated list of services to pass to docker-compose pull/up * Added --updated option to only pass the updated services to docker-compose pull/up
This commit is contained in:
@ -9,6 +9,8 @@ class ComposeConfiguration
|
||||
|
||||
private array $checks = [];
|
||||
|
||||
private array $services = [];
|
||||
|
||||
public function __construct(string $configfile)
|
||||
{
|
||||
$this->loadComposeFile($configfile);
|
||||
@ -23,6 +25,10 @@ class ComposeConfiguration
|
||||
if ($image && !in_array($image,$this->checks)) {
|
||||
$this->checks[] = $image;
|
||||
}
|
||||
if (!array_key_exists($image, $this->services)) {
|
||||
$this->services[$image] = [];
|
||||
}
|
||||
$this->services[$image][] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,4 +36,16 @@ class ComposeConfiguration
|
||||
{
|
||||
return $this->checks;
|
||||
}
|
||||
|
||||
public function getServicesForImages(array $images)
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($images as $ref) {
|
||||
$image = (string)$ref->ref;
|
||||
if (array_key_exists($image, $this->services)) {
|
||||
$ret = array_merge($ret, $this->services[$image]);
|
||||
}
|
||||
}
|
||||
return array_unique($ret);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user