Skip to content

Go mod download private git registry. #72

Answered by crazy-max
lichunqiang asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think this is relevant to goxx but your workflow as you would have the same issue when building with standard golang image but you can do smth similar to docker/build-push-action#1112 (comment) using a secret mount.

In your case:

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
  go mod download -x
EOT

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lichunqiang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants