ungleich-containers/build-version-via-dockerfile.sh
2024-10-05 14:44:42 +09:00

28 lines
431 B
Bash
Executable file

#!/bin/sh
set -exu
if [ $# -lt 1 ]; then
echo "$0 <container> [push]" >&2
exit 1
fi
container=$1; shift
name=harbor.k8s.ungleich.ch/ungleich-public/${container}
push=""
if [ $# -ge 1 ]; then
push=yes
fi
cd $container
for df in Dockerfile_*; do
version=$(echo $df | cut -d_ -f 2)
tag=${name}:${version}
docker build -t ${tag} -f ${df} .
if [ "$push" ]; then
docker push ${tag}
fi
done