From 072127a70cbaf77fdf56ea0d599118973bc793cd Mon Sep 17 00:00:00 2001 From: wang yan Date: Wed, 31 Oct 2018 15:43:22 +0800 Subject: [PATCH] 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 --- make/photon/clair/Dockerfile.binary | 3 ++- make/photon/clair/builder | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/make/photon/clair/Dockerfile.binary b/make/photon/clair/Dockerfile.binary index 4cdf7d0f3..87cf99fcf 100644 --- a/make/photon/clair/Dockerfile.binary +++ b/make/photon/clair/Dockerfile.binary @@ -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 diff --git a/make/photon/clair/builder b/make/photon/clair/builder index 086903f4d..860f5985b 100755 --- a/make/photon/clair/builder +++ b/make/photon/clair/builder @@ -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