Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sbt docker:stage work on Windows #842

Merged
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 @@ -59,10 +59,10 @@ object DockerPlugin extends AutoPlugin {
import autoImport._

/**
* The separator for makeAdd force UNIX separator.
* The separator doesn't depend to OS where i build Dockerfile.
* The separator used by makeAdd should be always forced to UNIX separator.
* The separator doesn't depend on the OS where Dockerfile is being built.
*/
val SeparatorChar = File.separatorChar
val UnixSeparatorChar = '/'

override def requires = universal.UniversalPlugin

Expand Down Expand Up @@ -158,7 +158,12 @@ object DockerPlugin extends AutoPlugin {
* @return ADD command adding all files inside the installation directory
*/
private final def makeAdd(dockerBaseDirectory: String): CmdLike = {
val files = dockerBaseDirectory.split(SeparatorChar)(1)
/**
* This is the file path of the file in the Docker image, and does not depend on the OS where the image
* is being built. This means that it needs to be the Unix file separator even when the image is built
* on e.g. Windows systems.
*/
val files = dockerBaseDirectory.split(UnixSeparatorChar)(1)
Cmd("ADD", s"$files /$files")
}

Expand Down