Build clair version into clair image

This commit is to add the clair_version into the harbor images, then clair
will use it in the user-agent, and helpful for the debugging.

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
wang yan 2018-10-31 15:43:22 +08:00
parent d517320c78
commit 072127a70c
2 changed files with 3 additions and 2 deletions

View File

@ -3,4 +3,5 @@ FROM golang:1.9.2
ADD . /go/src/github.com/coreos/clair/
WORKDIR /go/src/github.com/coreos/clair/
RUN go install -v github.com/coreos/clair/cmd/clair
RUN export CLAIR_VERSION=$(git describe --tag --always --dirty) && \
go build -ldflags "-X github.com/coreos/clair/pkg/version.Version=$CLAIR_VERSION" github.com/coreos/clair/cmd/clair

View File

@ -29,7 +29,7 @@ docker build -f $TEMP/Dockerfile.binary -t clair-golang $TEMP
echo 'copy the clair binary to local...'
ID=$(docker create clair-golang)
docker cp $ID:/go/bin/clair binary
docker cp $ID:/go/src/github.com/coreos/clair/clair binary
docker rm -f $ID
docker rmi -f clair-golang