devthefuture-org / dockerfile-x

Dockerfile factorization superset
https://codeberg.org/devthefuture/dockerfile-x/
MIT License
35 stars 4 forks source link

Missing rewrite for from parameter in RUN mount of type cache #9

Closed davireis closed 10 months ago

davireis commented 11 months ago

This package rewrites correctly several places where the name of an image/stage can show up. However, it seems to leave untouched the (somewhat obscure) from parameter used for initially populating the cache of a RUN mount. For example:

RUN --mount=type=cache,target=/root/.gradle/,rw,from=gradle_home_in ./gradlew --no-daemon tracker:jibBuildTar

This statement initializes the cache with the contents of the stage gradle_home_in. However, if that stage is defined in an included file, its name will be rewritten and the resulting Dockerfile will be invalid. The workaround is to define the stage in the top level Dockerfile.

devthejo commented 11 months ago

Thanks for pointing this, it was not supported until now https://github.com/devthefuture-org/dockerfile-x/commit/24c96945abb71076ea2c400491946c0f417a7cfb Please let me know if this fix your issue, and it's not the case give me a full example