I have a Go project, which is a private repo on GitHub. I want to build this project from source. I've tried running go get -d -v ./... && go install -v ./...
to install all dependencies, but this is the error I got fatal: could not read Username for 'https://github.com': terminal prompts disabled
which means that it tried to clone my project from GitHub rather than building it from source.
I can really use some help in properly building a Go project from source, with all the dependencies installed. I am using Docker and this is how my Dockerfile
looks:
#build stage
FROM golang:alpine AS builder
WORKDIR /go/src/app
COPY . .
RUN apk add --no-cache git
RUN go get -d -v ./...
RUN go install -v ./...
#final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=builder /go/bin/app /app
ENTRYPOINT ./app
EXPOSE 8080
Only my project's code is private, all other dependencies I have are publically available e.g. mux
. I have no problem if Go pulls those files from GitHub, but I want to compile my project's code from source.