harbor/make/photon/clair/builder
Ziming Zhang 744ae62831 upgrade clair to v2.1.1
Change-Id: Idb2ad0470a51666d75895d8c5e68d80a67e05276
Signed-off-by: Ziming Zhang <zziming@vmware.com>
2019-12-05 14:27:26 +08:00

39 lines
815 B
Bash
Executable File

#!/bin/bash
set +e
if [ -z $1 ]; then
error "Please set the 'version' variable"
exit 1
fi
VERSION="$1"
set -e
# the temp folder to store binary file...
mkdir -p binary
rm -rf binary/clair || true
cd `dirname $0`
cur=$PWD
# the temp folder to store distribution source code...
TEMP=`mktemp -d /$TMPDIR/clair.XXXXXX`
git clone -b $VERSION --single-branch https://github.com/quay/clair.git $TEMP
echo 'build the clair binary bases on the golang:1.13.4'
cp Dockerfile.binary $TEMP
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/src/github.com/quay/clair/clair binary
docker rm -f $ID
docker rmi -f clair-golang
echo "Build clair binary success, then to build photon image..."
cd $cur
rm -rf $TEMP