I am injecting a secret from the Github build pipeline. I can see the secret (a dummy value for now) being echoed in the run of the Dockerfile. I want to use the exec form for accessing the secret. Currently I have the following so far but it errors out:
RUN --mount=type=secret,id=PERSONAL_ACCESS_TOKEN \
export PERSONAL_ACCESS_TOKEN=$(cat /run/secrets/PERSONAL_ACCESS_TOKEN) && \
["mvn", "-s", "settings.xml", "clean", "install"]
When my build runs with the above instruction in Dockerfile I get the following error:
buildx failed with: ERROR: failed to solve: executor failed running
[/bin/sh -c export PERSONAL_ACCESS_TOKEN=$(cat /run/secrets/PERSONAL_ACCESS_TOKEN)
&& ["mvn", "-s", "settings.xml", "clean", "install"]]: exit code: 127
It seems like I can't use the exec form with the Run instruction for secrets. Is there a way to do the brackets with the Run instruction?