sbt-native-packager
sbt-native-packager copied to clipboard
DockerPermissionStrategy.MultiStage relies on COPY --chown
DockerPermissionStrategy.MultiStage is made available from Docker 17.05 onwards. However, it generates a COPY --chown, which is only available from 17.09 onwards.
As a result we encounter failures running docker build against Docker 17.06.
Thanks for your bug report.
This is the responsible code snippet. For me it looks like we check for 17.09 or higher. Could it be that the API version is too low?
The problem is with the multiStage snippet. It checks for 17.05, then uses makeCopyFrom, which in turn uses `COPY --from=... --chown=....
COPY --from=... --chown=... has the same version availability as COPY --chown (from 17.09 onwards).
A separate MultiStage permission strategy should have been viable without --chown (I assume this was the original intent). However, up until 19.03.07 ownership wasn't preserved when copying from previous stages—in effect forcing the --chown flag in both strategies.
I had the same problem, as the docker in my CI is 17.05 and it doesn't support COPY --chown.
For those who stumble upon this, a temporary fix is to change the permission strategy
dockerPermissionStrategy := DockerPermissionStrategy.Run