1
0
mirror of https://github.com/rancher/os.git synced 2025-05-03 13:46:20 +00:00
os/scripts/build-images

43 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-05-06 17:12:09 +00:00
#!/bin/bash
set -e
export ARCH=${ARCH:-"amd64"}
BASE=images
source $(dirname $0)/version
cd $(dirname $0)/..
DO_PUSH="$1"
2016-05-08 17:35:48 +00:00
if [ -n "$CORE" ]; then
PREFIX=0
fi
2016-05-06 17:12:09 +00:00
if [ "${DO_PUSH}" == "--push" ]; then
for i in $BASE/[0-9]*; do
name="os-$(echo ${i} | cut -f2 -d-)"
tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
echo Pushing ${tag}
docker push ${tag} || :
done
else
2016-05-08 17:35:48 +00:00
for i in $BASE/$PREFIX[0-9]*; do
2016-05-06 17:12:09 +00:00
name="os-$(echo ${i} | cut -f2 -d-)"
tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
echo Building ${tag}
if [ -x ${i}/prebuild.sh ]; then
if ${i}/prebuild.sh; then
dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i}
docker tag rancher/${name} ${tag}
elif [ "$?" != "42" ]; then
exit 1
else
echo "WARN: Skipping ${tag}"
fi
else
dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i}
docker tag rancher/${name} ${tag}
fi
done
fi