FROM golang:1.17-alpine as builder
ENV GOPRIVATE=github.com/XXXXX/
ARG GITHUB_TOKEN=$GITHUB_TOKEN
RUN apk update && apk add git gcc g++ libc-dev librdkafka-dev pkgconf && mkdir /app && git config --global url."https://someusername:$GITHUB_TOKEN@github.com".insteadOf "https://github.com"
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY ./ /app
RUN go build -tags dynamic
FROM alpine:3.1
RUN addgroup -S app && \
apk add --no-cache librdkafka-dev
RUN mkdir /logs && mkdir /app
WORKDIR /app
USER app
EXPOSE 8000 8001 8002
CMD ["./main"]
fatal: could not read Username for 'https://github.com': terminal prompts disabled Confirm the import path was entered correctly. If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
Any idea how can I fix it inside docker
When you're in an organization that uses SAML SSO, every personal access token that's used to access that organization's resources has to be specifically enabled for that organization.
You can go into the Personal Access Token settings and choose "Configure SSO". From there, you can enable the token for the specific organization that you're using. After that point, using it as normal should work.