2021-05-30 22:07:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Please specify a version"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version="$1"
|
|
|
|
if [[ $version == v* ]]; then
|
|
|
|
version="${version:1}"
|
|
|
|
fi
|
|
|
|
|
2021-06-07 23:58:05 +00:00
|
|
|
push=""
|
|
|
|
if [ -z "$2" ] || [ "$2" == "--push" ]; then
|
|
|
|
push="$2"
|
|
|
|
if [ ! -z "$push" ]; then
|
|
|
|
echo "Running with $push !"
|
|
|
|
fi
|
2022-05-20 22:44:17 +00:00
|
|
|
elif [ "$2" == "--load" ]; then
|
|
|
|
push="$2"
|
2021-06-07 23:58:05 +00:00
|
|
|
else
|
|
|
|
echo "Don't understand second argument: $2"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! docker buildx version > /dev/null; then
|
|
|
|
echo "The docker buildx command is required."
|
|
|
|
echo "See: https://github.com/docker/buildx#binary-release"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-30 22:08:30 +00:00
|
|
|
set -e
|
2021-05-30 22:07:11 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2021-06-07 23:58:05 +00:00
|
|
|
trap "{ docker buildx rm docspell-builder; }" EXIT
|
|
|
|
|
2022-08-26 12:59:50 +00:00
|
|
|
platforms=${PLATFORMS:-"linux/amd64,linux/arm64"}
|
2021-06-07 23:58:05 +00:00
|
|
|
docker buildx create --name docspell-builder --use
|
|
|
|
|
2022-01-23 00:06:00 +00:00
|
|
|
case $version in
|
|
|
|
*SNAPSHOT)
|
|
|
|
echo ">>>> Building nightly images for $version <<<<<"
|
|
|
|
url_base="https://github.com/eikek/docspell/releases/download/nightly"
|
2021-05-30 22:08:30 +00:00
|
|
|
|
2022-01-23 00:06:00 +00:00
|
|
|
echo "============ Building Restserver ============"
|
|
|
|
docker buildx build \
|
|
|
|
--platform="$platforms" $push \
|
|
|
|
--build-arg restserver_url="$url_base/docspell-restserver-$version.zip" \
|
|
|
|
--tag docspell/restserver:nightly \
|
|
|
|
-f restserver.dockerfile .
|
2021-05-30 22:08:30 +00:00
|
|
|
|
2022-01-23 00:06:00 +00:00
|
|
|
echo "============ Building Joex ============"
|
|
|
|
docker buildx build \
|
|
|
|
--platform="$platforms" $push \
|
|
|
|
--build-arg joex_url="$url_base/docspell-joex-$version.zip" \
|
|
|
|
--tag docspell/joex:nightly \
|
|
|
|
-f joex.dockerfile .
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo ">>>> Building release images for $version <<<<<"
|
|
|
|
echo "============ Building Restserver ============"
|
|
|
|
docker buildx build \
|
|
|
|
--platform="$platforms" $push \
|
|
|
|
--build-arg version=$version \
|
|
|
|
--tag docspell/restserver:v$version \
|
|
|
|
--tag docspell/restserver:latest \
|
|
|
|
-f restserver.dockerfile .
|
2021-05-30 22:08:30 +00:00
|
|
|
|
2022-01-23 00:06:00 +00:00
|
|
|
echo "============ Building Joex ============"
|
|
|
|
docker buildx build \
|
|
|
|
--platform="$platforms" $push \
|
|
|
|
--build-arg version=$version \
|
|
|
|
--tag docspell/joex:v$version \
|
|
|
|
--tag docspell/joex:latest \
|
|
|
|
-f joex.dockerfile .
|
|
|
|
esac
|