nim-docker/build.sh

39 lines
786 B
Bash
Raw Normal View History

2018-11-13 18:39:20 +00:00
#!/bin/sh
2018-03-14 17:58:58 +00:00
set -ev
buildAndPush() {
docker build -t statusteam/$1 $1
2018-11-13 18:39:20 +00:00
# docker push statusteam/$1
2018-03-14 17:58:58 +00:00
}
2018-11-13 20:49:58 +00:00
buildAndPushArch() {
# Copy template to temporary dir, make substitutions and run docker build
BASE=$1
DIR=tmp-$BASE
TAG=nim-base:$BASE
ARCH=$2
2018-11-13 21:00:21 +00:00
echo "Setting up $DIR for $ARCH"
2018-11-13 20:49:58 +00:00
mkdir -p $DIR
cp bootstrap.sh /usr/bin/qemu-$ARCH-static $DIR
cp Dockerfile.arch $DIR/Dockerfile
sed -i s/BASE/$BASE/ $DIR/Dockerfile
sed -i s/ARCH/$ARCH/ $DIR/Dockerfile
docker build -t statusteam/$TAG $DIR
# docker push statusteam/$TAG
rm -rf $DIR
}
2018-03-14 17:58:58 +00:00
if [ "$1" = "all" -o "$BUILD_ALL" = "true" ]
then
buildAndPush debian-pre-nim
fi
2018-11-13 19:47:19 +00:00
2018-11-13 21:28:47 +00:00
if [ "$BASE" = "" -o "$ARCH" = "" ]; then
2018-11-13 21:26:31 +00:00
buildAndPush nim-base
else
buildAndPushArch $BASE $ARCH
fi
2018-11-13 20:30:28 +00:00