diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala index 125f37532..6996c213a 100644 --- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala +++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala @@ -109,14 +109,15 @@ object DockerPlugin extends AutoPlugin { dockerRmiCommand := dockerExecCommand.value ++ Seq("rmi"), dockerBuildCommand := dockerExecCommand.value ++ Seq("build") ++ dockerBuildOptions.value ++ Seq("."), dockerAdditionalPermissions := { - val scripts = makeBashScripts.value - val ms = (mappings in Docker).value - scripts flatMap { - case (script, _) => - ms collect { - case (k, v) if k == script => DockerChmodType.UserGroupPlusExecute -> v - } - } + val basePath = (defaultLinuxInstallLocation in Docker).value + (mappings in Docker).value + .collect { + // by default we assume everything in the bin/ folder should be executable that is not a .bat file + case (_, path) if path.startsWith(s"$basePath/bin/") && !path.endsWith(".bat") => + DockerChmodType.UserGroupPlusExecute -> path + // sh files should also be marked as executable + case (_, path) if path.endsWith(".sh") => DockerChmodType.UserGroupPlusExecute -> path + } }, dockerCommands := { val strategy = dockerPermissionStrategy.value