The issue #175 introduced an extra layer for the chown that is doubling the content size of the chown ed folder (for an image containing the jdk+jboss it could be huge).
Is it possible to avoid this extra layer using a single CMD (without the COPY)?
By doing a curl and chown in the same RUN command, this drastically reduces the image size, but in this case I have to use an external Dockerfile and I'd prefer being fully maven-style (using the assembly).
Any idea how to fix this?
I see the point, but I wonder how we could doing the COPY / ADD from the assembly and the chown in one layer. The real pita is that https://github.com/docker/docker/issues/6119 doesnt get fixed.
If you have an idea I'm happy to add this as an optimization.
@rhuss Hi Roland, as moby/moby#6119 is fixed now, could you please kindly make an optimization?
Good point, will start working on it hopefully soonish. Do you know the Docker (or even better API) version, since when these flags are available ?
The feature is included in Docker 17.09 and up quoted from moby/moby#6119
I also noticed another downside of current implementation.
Since the temporary directory name is randomly generated, docker can't reuse the build cache even if the content of the assembly is not changed.

Using --chown would solve this too.
@rohanKanojia If you have some spare cycles (not necessarily for the next release), could you give a look to get rid of our own chown mechanism and use that from Docker (for Docker >= 17.09) ?
Most helpful comment
The feature is included in Docker 17.09 and upquoted from moby/moby#6119