Skip to content

Commit

Permalink
Fixed kompose build failure
Browse files Browse the repository at this point in the history
While `local` build, kompose was not recognizing `dockerfile` key
Hence it was breaking the build as mentioned in issue #832.
This PR will fix the issue.
  • Loading branch information
surajnarwade committed Dec 1, 2017
1 parent 8a5692b commit 286fbd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/transformer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func BuildDockerImage(service kobject.ServiceConfig, name string, relativePath s
// Use the build struct function to build the image
// Build the image!
build := docker.Build{Client: *client}
err = build.BuildImage(imagePath, imageName)
err = build.BuildImage(imagePath, imageName, service.Dockerfile)

if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/docker/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ BuildImage builds a Docker image via the Docker API. Takes the source directory
and image name and then builds the appropriate image. Tarball is utilized
in order to make building easier.
*/
func (c *Build) BuildImage(source string, image string) error {
func (c *Build) BuildImage(source string, image string, dockerfile string) error {

log.Infof("Building image '%s' from directory '%s'", image, path.Base(source))

Expand Down Expand Up @@ -67,6 +67,7 @@ func (c *Build) BuildImage(source string, image string) error {
Name: image,
InputStream: tarballSource,
OutputStream: outputBuffer,
Dockerfile: dockerfile,
}

// Build it!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "2"

services:
foo:
build:
context: .
dockerfile: build/Dockerfile
image: docker.io/cdrage/foobar

0 comments on commit 286fbd1

Please sign in to comment.