build-docker-images.sh: push to Docker Hub as well
This commit is contained in:
parent
348a4b0865
commit
5c8bbe5801
1 changed files with 22 additions and 1 deletions
|
@ -1,11 +1,32 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
arg_push=
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--push) arg_push=y ; shift ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
default_suffix=alpine
|
||||||
prefix="${1:-local/}"
|
prefix="${1:-local/}"
|
||||||
|
|
||||||
for dokerfile in dockerfiles/Dockerfile.* ; do
|
for dokerfile in dockerfiles/Dockerfile.* ; do
|
||||||
suffix="`echo "$dokerfile" | sed 's/.*\/Dockerfile\.//'`"
|
suffix="`echo "$dokerfile" | sed 's/.*\/Dockerfile\.//'`"
|
||||||
image_name="${prefix}zeronet:$suffix"
|
image_name="${prefix}zeronet:$suffix"
|
||||||
|
|
||||||
|
latest=""
|
||||||
|
t_latest=""
|
||||||
|
if [ "$suffix" = "$default_suffix" ] ; then
|
||||||
|
latest="${prefix}zeronet:latest"
|
||||||
|
t_latest="-t ${latest}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "DOCKER BUILD $image_name"
|
echo "DOCKER BUILD $image_name"
|
||||||
docker build -f "$dokerfile" -t "$image_name" .
|
docker build -f "$dokerfile" -t "$image_name" $t_latest .
|
||||||
|
if [ -n "$arg_push" ] ; then
|
||||||
|
docker push "$image_name"
|
||||||
|
if [ -n "$latest" ] ; then
|
||||||
|
docker push "$latest"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue