First iteration of the build command

This commit is contained in:
Gordon Heydon
2018-02-27 12:34:48 +11:00
parent 0bd195e5a9
commit 18eea076d7
2 changed files with 69 additions and 0 deletions

62
src/Task/Build.php Executable file
View File

@@ -0,0 +1,62 @@
<?php
namespace Droath\RoboDockerCompose\Task;
use Droath\RoboDockerCompose\DockerServicesTrait;
/**
* Define docker compose pause command.
*/
class Build extends Base
{
use DockerServicesTrait;
/**
* {@inheritdoc}
*/
protected $action = 'build';
/**
* Set the build-rm option
*/
public function buildRm()
{
$this->option('build-rm');
}
/**
* Set no-cache option
*/
public function noCache()
{
$this->option('no-cache');
}
/**
* Use the pull option
*/
public function pull()
{
$this->option('pull');
}
/**
* Add a build arg.
*
* @param $var
* @param $variable
*/
public function buildArg($var, $value)
{
$this->option('build-arg', "{$var}={$value}");
}
/**
* {@inheritdoc}
*/
public function getCommand()
{
return "{$this->executable} {$this->executableArgs} {$this->action} {$this->arguments} " . implode(' ', $this->services);
}
}

View File

@@ -55,4 +55,11 @@ trait loadTasks
return $this->task(Execute::class, $pathToDockerCompose);
}
/**
* Docker compose build task.
*/
protected function taskDockerComposeBuild($pathToDockerCompose = null)
{
return $this->task(Build::class, $pathToDockerCompose);
}
}