Skip to content

Commit b4d7cd1

Browse files
oporkkamuuki88
authored andcommitted
Make sbt docker:stage work on Windows (#824)
Closes #823
1 parent 54fb9aa commit b4d7cd1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala

+9-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ object DockerPlugin extends AutoPlugin {
6060
import autoImport._
6161

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

6868
override def requires = universal.UniversalPlugin
6969

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

0 commit comments

Comments
 (0)