FROM golang:1.18 as serverbuilder
ARG GITHUB_TOKEN
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
ENV GO111MODULE=on \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOPROXY=https://goproxy.cn,direct \
    GOARCH=amd64 \
    GOPRIVATE=github.com/tidbcloud

WORKDIR /goapp
COPY . .
RUN go mod tidy
RUN go build -o ./bin/grpc-test ./pkg/cmd/grpc_test/

# Set the image's default run command
CMD ["/goapp/bin/grpc-test"]
