2017-07-24 12:21:38 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
error "Please set the 'version' variable"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-07-24 10:41:58 +02:00
|
|
|
if [ -z $2 ]; then
|
|
|
|
error "Please set the 'distribution_src' variable"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-24 12:21:38 +02:00
|
|
|
VERSION="$1"
|
2024-07-24 10:41:58 +02:00
|
|
|
DISTRIBUTION_SRC="$2"
|
2017-07-24 12:21:38 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# the temp folder to store binary file...
|
|
|
|
mkdir -p binary
|
|
|
|
rm -rf binary/registry || true
|
|
|
|
|
|
|
|
cd `dirname $0`
|
|
|
|
cur=$PWD
|
|
|
|
|
|
|
|
# the temp folder to store distribution source code...
|
2019-10-26 19:25:36 +02:00
|
|
|
TEMP=`mktemp -d ${TMPDIR-/tmp}/distribution.XXXXXX`
|
2024-07-24 10:41:58 +02:00
|
|
|
git clone -b $VERSION $DISTRIBUTION_SRC $TEMP
|
2017-07-24 12:21:38 +02:00
|
|
|
|
2021-03-04 08:33:09 +01:00
|
|
|
# add patch redis
|
2022-04-29 02:51:49 +02:00
|
|
|
cd $TEMP
|
2020-06-15 18:20:18 +02:00
|
|
|
git apply $cur/redis.patch
|
2019-09-24 05:17:15 +02:00
|
|
|
cd $cur
|
|
|
|
|
2019-10-20 15:10:55 +02:00
|
|
|
echo 'build the registry binary ...'
|
2017-07-25 03:32:50 +02:00
|
|
|
cp Dockerfile.binary $TEMP
|
2017-07-25 02:49:59 +02:00
|
|
|
docker build -f $TEMP/Dockerfile.binary -t registry-golang $TEMP
|
2017-07-24 12:21:38 +02:00
|
|
|
|
|
|
|
echo 'copy the registry binary to local...'
|
|
|
|
ID=$(docker create registry-golang)
|
2019-10-26 19:25:36 +02:00
|
|
|
docker cp $ID:/go/src/github.com/docker/distribution/bin/registry binary/registry
|
2017-07-24 12:21:38 +02:00
|
|
|
|
|
|
|
docker rm -f $ID
|
|
|
|
docker rmi -f registry-golang
|
|
|
|
|
|
|
|
echo "Build registry binary success, then to build photon image..."
|
|
|
|
cd $cur
|
2017-08-30 10:13:54 +02:00
|
|
|
cp $TEMP/cmd/registry/config-example.yml config.yml
|
2017-07-24 12:21:38 +02:00
|
|
|
rm -rf $TEMP
|