Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90b7786dc9 | ||
|
|
b0c126c271 |
@@ -49,6 +49,20 @@ abstract class Base extends BaseTask
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$command = $this->getCommand();
|
||||
$this->printTaskInfo(
|
||||
'Running Docker-Compose: {command}',
|
||||
['command' => $command]
|
||||
);
|
||||
|
||||
return $this->executeCommand($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get docker-compose command.
|
||||
*
|
||||
|
||||
@@ -60,15 +60,4 @@ class Down extends Base
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$command = $this->getCommand();
|
||||
$this->printTaskInfo('Docker Down: {command}', ['command' => $command]);
|
||||
|
||||
return $this->executeCommand($command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,13 @@ class Up extends Base
|
||||
*/
|
||||
protected $action = 'up';
|
||||
|
||||
/**
|
||||
* Docker compose services.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $services = [];
|
||||
|
||||
/**
|
||||
* Command detached mode.
|
||||
*
|
||||
@@ -21,6 +28,34 @@ class Up extends Base
|
||||
*/
|
||||
protected $detachedMode = false;
|
||||
|
||||
/**
|
||||
* Add docker composer service.
|
||||
*
|
||||
* @param string $service
|
||||
* The docker services.
|
||||
*/
|
||||
public function setService($service)
|
||||
{
|
||||
$this->services[] = $service;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add docker composer services.
|
||||
*
|
||||
* @param array $services
|
||||
* An array of services.
|
||||
*/
|
||||
public function setServices(array $services)
|
||||
{
|
||||
foreach ($services as $service) {
|
||||
$this->setService($service);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run containers in the background.
|
||||
*/
|
||||
@@ -115,12 +150,10 @@ class Up extends Base
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
protected function getCommand()
|
||||
{
|
||||
$command = $this->getCommand();
|
||||
$this->printTaskInfo('Docker Up: {command}', ['command' => $command]);
|
||||
|
||||
return $this->executeCommand($command);
|
||||
// Append the services to the end of the command.
|
||||
return parent::getCommand() . ' ' . implode(' ', $this->services);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user