Skip to content

Commit

Permalink
fixed logic to determine location of dockerfile if dockerFile and doc…
Browse files Browse the repository at this point in the history
…kerFileDir also set

Signed-off-by: Laszlo Meszaros <lacienator@gmail.com>
  • Loading branch information
lmesz committed Nov 25, 2016
1 parent 59f5fa7 commit 5ea81cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ public String initAndValidate(Logger log) throws IllegalArgumentException {

// Initialize the dockerfile location and the build mode
private void initDockerFileFile(Logger log) {
if (dockerFile != null) {
if (dockerFile != null && dockerFileDir != null) {
dockerFileFile = new File(dockerFileDir, dockerFile);
dockerFileMode = true;
} else if (dockerFile != null) {
dockerFileFile = new File(dockerFile);
dockerFileMode = true;
} else if (dockerFileDir != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ public void simpleDockerfileDir() {
assertEquals(config.getDockerFile(),new File("src/docker/Dockerfile"));
}

@Test
public void simpleDockerfileDirAndDockerfile() {
BuildImageConfiguration config =
new BuildImageConfiguration.Builder().
dockerFileDir("/tmp/").
dockerFile("Dockerfile").build();
config.initAndValidate(logger);
assertTrue(config.isDockerFileMode());
assertEquals(config.getDockerFile(),new File("/tmp/Dockerfile"));
}

@Test
public void deprecatedDockerfileDir() {
AssemblyConfiguration assemblyConfig = new AssemblyConfiguration.Builder().dockerFileDir("src/docker").build();
Expand Down

0 comments on commit 5ea81cd

Please sign in to comment.