mastodon/build-images.sh

37 lines
940 B
Bash
Raw Normal View History

2019-10-13 22:48:42 +00:00
#!/usr/bin/env bash
set -xe
TAG=$1
require_input() {
input=$1
name=$2
if [ "$input" == "" ]; then
echo "Input, $name, required but not present"
exit 1;
fi
}
require_input "$TAG" "container tag"
2019-10-15 03:19:35 +00:00
architectures=('arm64v8' 'arm32v7' 'amd64')
2019-10-13 22:48:42 +00:00
for architecture in "${architectures[@]}"; do
sed "s/FROM ubuntu/FROM $architecture\/ubuntu/g" Dockerfile > "Dockerfile-$architecture"
if [ "$architecture" == arm32v7 ]; then
sed -i'' 's/x64/armv7l/g' "Dockerfile-$architecture" # for node
sed -i'' 's/amd64/armhf/g' "Dockerfile-$architecture" # for tini
fi
if [ "$architecture" == arm64v8 ]; then
sed -i'' 's/x64/arm64/g' "Dockerfile-$architecture" # for node
sed -i'' 's/amd64/arm64/g' "Dockerfile-$architecture" # for tini
fi
buildah build-using-dockerfile -f "Dockerfile-$architecture" -t "$TAG-$architecture" .
rm "Dockerfile-$architecture"
done