11eb92ab49a9942e9c7e3c8d39202f50c2ed6418
[yaffs-website] / Build.php
1 <?php
2 namespace Robo\Task\Docker;
3
4 /**
5  * Builds Docker image
6  *
7  * ```php
8  * <?php
9  * $this->taskDockerBuild()->run();
10  *
11  * $this->taskDockerBuild('path/to/dir')
12  *      ->tag('database')
13  *      ->run();
14  *
15  * ?>
16  *
17  * ```
18  *
19  * Class Build
20  * @package Robo\Task\Docker
21  */
22 class Build extends Base
23 {
24     /**
25      * @var string
26      */
27     protected $path;
28
29     /**
30      * @param string $path
31      */
32     public function __construct($path = '.')
33     {
34         $this->command = "docker build";
35         $this->path = $path;
36     }
37
38     /**
39      * {@inheritdoc}
40      */
41     public function getCommand()
42     {
43         return $this->command . ' ' . $this->arguments . ' ' . $this->path;
44     }
45
46     /**
47      * @param string $tag
48      *
49      * @return $this
50      */
51     public function tag($tag)
52     {
53         return $this->option('-t', $tag);
54     }
55 }