Reputation: 267
I'm trying to get a docker image to build that requires it to clone a private github repo.
Upvotes: 0
Views: 378
Reputation: 5103
I had a hard time figuring out how to do this without copying my ssh keys over - my eventual solution was to use a github basic auth token in URL format passed into docker as a build argument.
ARG GITHUB_URL RUN git config --global url.$GITHUB_URL.insteadOf "https://github.com/"
RUN go get -u github.com/YOUR_USERNAME/YOUR_REPO
docker build -t YOUR_TAG . --build-arg GITHUB_URL="https://[YOUR_GITHUB_TOKEN]:[email protected]/"
Upvotes: 1