Skip to content

Commit

Permalink
Make sbt docker:stage work on Windows (#824)
Browse files Browse the repository at this point in the history
Closes #823
  • Loading branch information
oporkka authored and muuki88 committed Jun 24, 2016
1 parent 54fb9aa commit b4d7cd1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,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 @@ -159,7 +159,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

0 comments on commit b4d7cd1

Please sign in to comment.