Skip to content

Commit 64b64ab

Browse files
committed
Get package from go.mod
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
1 parent e6b1635 commit 64b64ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ WORKDIR $GOPATH/src/${PKG}
1919
RUN git fetch --all --tags --prune
2020
RUN git checkout tags/${TAG} -b ${TAG}
2121
RUN go mod edit -replace github.com/docker/docker=github.com/docker/docker@v27.1.1+incompatible && go mod tidy && go mod vendor
22-
ENV GO_LDFLAGS="-linkmode=external -X ${PKG}/pkg/version.Version=${TAG}"
23-
RUN go-build-static.sh -gcflags=-trimpath=${GOPATH}/src -o bin/crictl ./cmd/crictl
22+
RUN GO_LDFLAGS="-linkmode=external -X $(awk '/^module /{print $2}' go.mod)/pkg/version.Version=${TAG}" \
23+
go-build-static.sh -gcflags=-trimpath=${GOPATH}/src -o bin/crictl ./cmd/crictl
2424
RUN go-assert-static.sh bin/*
2525
RUN if [ "${ARCH}" = "amd64" ]; then \
2626
go-assert-boring.sh bin/* ; \

0 commit comments

Comments
 (0)