-
Notifications
You must be signed in to change notification settings - Fork 443
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
Error due to path separator inconsistency on windows #1329
Comments
Quickly checked the code. Doesn't seem like it could be introduced. I don't have windows to check. |
AFAICT, this is a combination of two problematic behaviors.
I don't think either of these is new. Most likely we didn't encounter this issue because no one had bothered generated Dockerfiles on Windows before. One way we can fix the first issue is by post-processing the mappings in |
Thanks for taking a quick @ppiotrow 👍 I agree @nigredo-tori , the mappings are the core issue for this.
That would probably the sanest way to do.
You mean we store the docker build environment in a setting, e.g. sealed trait DockerBuildHost
case object Windows
case object Unix
val settingKey dockerBuildHost = setting[DockerBuildHost]("...")
dockerBuildHost = detectOS() |
Pretty much. The name should reference the image rather than the build host, but right now that's distinction without difference. 😄 However, I think we can start with something lower-level: val dockerImagePathSeparator = settingKey[Char](...)
// we almost always build *nix images.
dockerImagePathSeparator := '/' Or just don't add this knob until someone actually tries to build a Windows image. I think |
I like the lower-level approach. It's much clearer what the purposes is and easier to configure.
I understood the issue that on the host system windows things get strange. Not that a docker image is based on windows, right? Docker confuses me so fast 😜 My point is that a lower level key setting should ideally still be configured automatically by detecting the underlying OS to... oh no... You only need this if you build an actual windows docker image. We take that solution! @cchafer any chance you want to dig into the depths of the docker plugin 😂 |
We actually have 3 environments here:
The issue here is that on the SBT host the generated mappings use Windows path separators (backslashes). However, the image (where the |
Sorry for my late reply, Covid doesn't help. This said, if I can help, let me know ! |
I've been wrestling for hours with a problem that may be related, though it has nothing whatever to do with Docker. I want to control the collection of files archived by universal:packageZipTarball on a Windows system. Specifically, I want to archive everything in lazy val zipping = {
mappings --= (file("excluded/directory") ** "*")
.get
.map(file => baseDirectory.value / file.getPath -> file.getPath)
} Running Consequently I have to employ the following string replacement hack to get the desired behavior. lazy val zipping = {
mappings --= (file("excluded/directory") ** "*")
.get
.map(file => baseDirectory.value / file.getPath -> file.getPath.replaceFirst("\\\\", "/"))
} So, while it's true that
that's not the whole problem for me, because system path separators aren't used exclusively. If they were, my hack wouldn't be required. It might be better in the general case if the destination paths used |
@JessePelton what you describe looks like a bug in sbt itself 😮 as all the code you wrote is not native-packager related. @nigredo-tori explained the issue with SBT host and docker image path separators very well. So not sure if a fix in sbt would solve this issue too. |
Hi, just made a PR that (at least) fixes my problem. So what I do is just checking if current system separator is consistent, and if not, replace in result string. Checked by constructing a DockerFile on Windows, that can then be built on Linux. |
Expected behaviour
sbt stage
executed on windows should generate a consistent dockerfile, in terms of paths description.Actual behaviour
Some paths in the output Dockerfile mix / and \, resulting in an error when building the image.
Information
Reproduction
I'm using a custom start script, called "startDocker.sh" and put in /src/universal/bin
When adding a custom entrypoint in sbt
the result on macos / linux contains (as expected):
but on windows, the same line is
I would not bother too much about this if the consequence wasn't docker to return the following error when running docker build (or docker:publish)
The text was updated successfully, but these errors were encountered: