Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

[fix] Specify the dockerfile path when building under windows, the re… #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.apache.commons.io.FilenameUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
Expand Down Expand Up @@ -70,6 +72,7 @@ public class BuildMojo extends AbstractDockerMojo {
@Parameter(property = "dockerfile.dockerfile", required = false)
private File dockerfile;


/**
* The repository to put the built image into when building the Dockerfile, for example
* <tt>spotify/foo</tt>. You should also set the <tt>tag</tt> parameter, otherwise the tag
Expand Down Expand Up @@ -179,8 +182,8 @@ static String buildImage(@Nonnull DockerClient dockerClient,

final ArrayList<DockerClient.BuildParam> buildParameters = new ArrayList<>();
if (dockerfile != null) {
buildParameters.add(DockerClient.BuildParam.dockerfile(
contextDirectory.relativize(dockerfile)));
buildParameters.add(new DockerClient.BuildParam("dockerfile",
FilenameUtils.separatorsToUnix(contextDirectory.relativize(dockerfile).toString())));
}

final LoggingProgressHandler progressHandler = new LoggingProgressHandler(log, verbose);
Expand Down