-
Notifications
You must be signed in to change notification settings - Fork 57
image build failed with error "fatal: not a git repository (or any of the parent directories): .git" #46
Description
Hi
I tried to run make dockr to build image, and it is failed as below, if the golang:1 base image is not correct?
in my environment, i see the base image is docker.io/library/golang:1
[1/2] STEP 1/7: FROM golang:1 AS build
[1/2] STEP 2/7: WORKDIR /sidecarinjector
--> Using cache f6c0341009898f985698892b589608c7dde3f9cee285f4bbca301596dd506943
--> f6c03410098
[1/2] STEP 3/7: COPY go.mod go.sum ./
--> Using cache 2ec6cab42b756aa6dbd04507328613f00a6d2ee8ec2ccdaa66f08c6d4061a6ae
--> 2ec6cab42b7
[1/2] STEP 4/7: RUN go mod download
--> Using cache 0c864f93055bad9a5386ceff63b14b035d94bda9df4da6ccfe511d7483d7df50
--> 0c864f93055
[1/2] STEP 5/7: COPY . ./
--> 65cfd9e6215
[1/2] STEP 6/7: COPY pkg ./pkg
--> 4b48cf1e32e
[1/2] STEP 7/7: RUN GIT_HASH=$(git rev-parse --short HEAD) && GIT_TAG=$(git tag | tail -1) && CGO_ENABLED=0 && GOOS=linux && GOARCH=amd64 && echo "GIT_HASH=$GIT_HASH" && echo "GIT_TAG=$GIT_TAG" && go build -ldflags "-X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitHash=$GIT_HASH' -X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitTag=$GIT_TAG' -s" -installsuffix cgo -o sidecarinjector ./cmd/sidecarinjector
fatal: not a git repository (or any of the parent directories): .git
[2/2] STEP 1/4: FROM golang:1
Error: error building at STEP "RUN GIT_HASH=$(git rev-parse --short HEAD) && GIT_TAG=$(git tag | tail -1) && CGO_ENABLED=0 && GOOS=linux && GOARCH=amd64 && echo "GIT_HASH=$GIT_HASH" && echo "GIT_TAG=$GIT_TAG" && go build -ldflags "-X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitHash=$GIT_HASH' -X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitTag=$GIT_TAG' -s" -installsuffix cgo -o sidecarinjector ./cmd/sidecarinjector": error while running runtime: exit status 128
make: *** [podman] Error 125