You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ENV MOUNT_CMD=--mount=type=cache,target=blah
RUN $MOUNT_CMD go mod download
I get a error like
#14 0.404 /bin/sh: 1: --mount="type=cache,target=/root/.local/share/golang": not found
Its as if the "--mount..." isnt perceived as a RUN option.
Workaround? Maybe just mount the env var only, bc that is supported....
But mounting a option in workaround failed also...
ENV CACHE_GOBUILD=/root/.cache/go-build
ENV CACHE_GOLANG=/root/.local/share/golang
ENV CACHE_GOMOD=/go/pkg/mod
WORKDIR /workspace/tkr
RUN --mount=type=cache,target=$CACHE_GOBUILD go mod download
yields
failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 49: invalid field '${CACHE_GOBUILD}' must be a key=value pair
The text was updated successfully, but these errors were encountered:
We only support expanding the values inside the mount, not the keys, or a combination of the above (for more information, you might be interested in the PR that added the mount expansion functionality: #2089).
Only the arguments inside the cache-mount are evaluated using interpolation. Think of the order for parsing as parse instructions -> perform interpolation - there's not way of having the results of interpolation affect the parsing.
This is by design! 🎉 It's actually a massive pain to have interpolation affect parsing, since then you need quoting rules like in sh(/bash/dash/etc) to be able to have it not do that extra interpolation when your cache target might contain "special" characters like = or ,. The complexity of this really quickly spirals out of control, so we just don't support that.
If we want to allow programmatic usage of flags and similar, we'd probably lean towards doing something closer to #1209, instead of fundamentally changing how the Dockerfile is parsed.
Run doesn't seem to like interpolation
If I run
I get a error like
Its as if the "--mount..." isnt perceived as a RUN option.
Workaround? Maybe just mount the env var only, bc that is supported....
But mounting a option in workaround failed also...
yields
The text was updated successfully, but these errors were encountered: