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.
|
* Get docker-compose command.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -60,15 +60,4 @@ class Down extends Base
|
|||||||
|
|
||||||
return $this;
|
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';
|
protected $action = 'up';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Docker compose services.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $services = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command detached mode.
|
* Command detached mode.
|
||||||
*
|
*
|
||||||
@@ -21,6 +28,34 @@ class Up extends Base
|
|||||||
*/
|
*/
|
||||||
protected $detachedMode = false;
|
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.
|
* Run containers in the background.
|
||||||
*/
|
*/
|
||||||
@@ -115,12 +150,10 @@ class Up extends Base
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function run()
|
protected function getCommand()
|
||||||
{
|
{
|
||||||
$command = $this->getCommand();
|
// Append the services to the end of the command.
|
||||||
$this->printTaskInfo('Docker Up: {command}', ['command' => $command]);
|
return parent::getCommand() . ' ' . implode(' ', $this->services);
|
||||||
|
|
||||||
return $this->executeCommand($command);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user