2017-12-09 19:53:12 +01:00
|
|
|
#!/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`
|
2018-08-31 09:59:56 +02:00
|
|
|
git clone https://github.com/coreos/clair.git $TEMP
|
|
|
|
cd $TEMP; git checkout $VERSION; cd -
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2019-11-25 09:01:09 +01:00
|
|
|
echo 'build the clair binary bases on the golang:1.13.4'
|
2017-12-09 19:53:12 +01:00
|
|
|
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)
|
2018-10-31 08:43:22 +01:00
|
|
|
docker cp $ID:/go/src/github.com/coreos/clair/clair binary
|
2017-12-09 19:53:12 +01:00
|
|
|
|
|
|
|
docker rm -f $ID
|
|
|
|
docker rmi -f clair-golang
|
|
|
|
|
|
|
|
echo "Build clair binary success, then to build photon image..."
|
|
|
|
cd $cur
|
|
|
|
rm -rf $TEMP
|