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 Oct 9, 2017
1 parent f42450b commit cb82a2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/transformer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,16 @@ func BuildDockerImage(service kobject.ServiceConfig, name string, relativePath s

// Get the appropriate image source and name
// use path.Base to get the last element of the relative build path
imagePath := path.Join(relativePath, path.Base(service.Build))
var imagePath string
if service.Dockerfile != "" {
//imagePath = path.Join(relativePath, service.Build)
dockerfile_dir, _ := path.Split(service.Dockerfile)
//imagePath = path.Join(imagePath, dockerfile_dir)
imagePath = path.Join(relativePath, service.Build, dockerfile_dir)
} else {
imagePath = path.Join(relativePath, service.Build)
}

imageName := name
if service.Image != "" {
imageName = service.Image
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 cb82a2c

Please sign in to comment.