Is there a way to change the WORKDIR to the first pattern matched folder? something like
SHELL ["/bin/bash", "-c"]
RUN pattern=mypattern*
RUN files=( $pattern )
WORKDIR $files
Unlike my local terminal behaviour the files variable remains empty, eventhough the current WORKDIR is correct and the folder most certainly exists based on docker buil logs.
EDIT: for clarification, the use case is:
There is a Go package (lilliput) which comes with prebuilt binaries, but these binaries don't work on the platform our docker imagine will be running on. Thankfully this package provides a build_deps.sh
for such cases, but this has to be executed from the package installation folder. This folder will have a arbitrary name based on the package release version (eg lilliput@v0.0.0-20210720001558-e1547514bd5f
)
The Goal is to pattern match this folder and lilliput*
, switch the WORKDIR and start the dependency build there.