(image string)
| 10 | ) |
| 11 | |
| 12 | func (c *Command) buildDockerImage(image string) error { |
| 13 | buildPath, err := c.globalFlags.GetApplicationDirectory() |
| 14 | if err != nil { |
| 15 | return err |
| 16 | } |
| 17 | |
| 18 | dockerfilePath := conv.S(c._commandFlags.DockerfilePath) |
| 19 | if utils.IsBlank(dockerfilePath) { |
| 20 | dockerfilePath = "Dockerfile" |
| 21 | } |
| 22 | |
| 23 | if !filepath.IsAbs(dockerfilePath) { |
| 24 | var err error |
| 25 | dockerfilePath, err = filepath.Abs(dockerfilePath) |
| 26 | if err != nil { |
| 27 | return fmt.Errorf("Error retrieving absolute path [%s]: %s", dockerfilePath, err.Error()) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // docker build |
| 32 | if err = c.dockerClient.BuildImage(buildPath, dockerfilePath, image); err != nil { |
| 33 | return err |
| 34 | } |
| 35 | |
| 36 | return nil |
| 37 | } |
| 38 | |
| 39 | func (c *Command) pushDockerImage(image string) error { |
| 40 | console.Info("Authenticating to push to ECR Repository...") |
no test coverage detected