Closed oktayalizada closed 1 month ago
GIT_AUTH_TOKEN
is only used by BuildKit to clone Git sources and doesn't apply to RUN
instructions directly for any git
command invocations.
You need to handle this yourself in the step RUN mix deps.get --only $MIX_ENV
by using a secret mount and managing git configuration.
Something similar to:
RUN --mount=type=secret,id=GIT_AUTH_TOKEN \
set -e
GIT_AUTH_TOKEN=$(cat /run/secrets/GIT_AUTH_TOKEN)
if [ -n "$GIT_AUTH_TOKEN" ]; then
echo "Setting GitHub access token"
git config --global "url.https://x-access-token:${GIT_AUTH_TOKEN}@github.com.insteadof" "https://github.com"
fi
mix deps.get --only $MIX_ENV
EOT
Would need to see your Dockerfile to make sure you don't do it with the final stage but dependent one to avoid exposing the secret in git config.
Using this, with Mix as the build system as well, I get the following error:
1.191 remote: Support for password authentication was removed on August 13, 2021.
Your previous post was from this year (May 2023), which leaves me a bit confused in combination with the error message. :D
Is there a new approach you know of? I've been searching through the web for most of today and have not figured it out yet
Got it, basically remove the x-access-token: from the URL rewrite.
Contributing guidelines
I've found a bug, and:
Description
Could be related to the following issue but got resolved long time ago and was related to v2 specifically: https://github.com/docker/build-push-action/issues/162
Steps to reproduce:
Expected behaviour
Should be able to build image
Actual behaviour
Repository URL
No response
Workflow run URL
No response
YAML workflow
Workflow logs
No response
BuildKit logs
No response
Additional info
No response