diff --git a/src/Task/Build.php b/src/Task/Build.php new file mode 100755 index 0000000..945a9f9 --- /dev/null +++ b/src/Task/Build.php @@ -0,0 +1,62 @@ +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); + } +} diff --git a/src/Task/loadTasks.php b/src/Task/loadTasks.php index 8162800..ac04ea2 100755 --- a/src/Task/loadTasks.php +++ b/src/Task/loadTasks.php @@ -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); + } }