1
0

More than 3 years have passed since last update.

Docker - How to Get Private Git Repository Inner Golang Container via HTTP?

Last updated at Posted at 2019-11-30

You may be put your golang modules in a self-hosting git repository which likes gitlab. The most ways to tell us using ssh method and it is not easy enough (need to generate ssh key). I am just want to use https to get golang modules.

FROM golang:1.13.4-alpine
...
...
...
ARG GIT_URL
ARG GIT_GROUP
ARG GIT_ACCOUNT
ARG GIT_PASSWORD

RUN apk update -qq && apk --no-cache add git

RUN printf "machine ${GIT_URL}\n\
    login ${GIT_ACCOUNT}\n\
    password ${GIT_PASSWORD}\n"\
    >> /root/.netrc
RUN chmod 600 /root/.netrc

RUN go env -w GOPRIVATE=${GIT_URL}/${GIT_GROUP}
...
...
...

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0