2020-02-01 01:34:23 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
VERSION=$1
|
|
|
|
NEXTCLOUD_RELEASE=$2
|
|
|
|
|
|
|
|
function require() {
|
|
|
|
if [ "$1" = "" ]; then
|
|
|
|
echo "input '$2' required"
|
|
|
|
print_help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_help() {
|
|
|
|
echo "build.sh"
|
|
|
|
echo ""
|
|
|
|
echo "Usage:"
|
|
|
|
echo " build.sh [version] [nextcloud_release]"
|
|
|
|
echo ""
|
|
|
|
echo "Args:"
|
2021-06-19 23:22:39 +00:00
|
|
|
echo " version: The version of the current container (e.g. ls4)"
|
|
|
|
echo " nextcloud_release: The release of nextcloud to include (e.g. 21.0.1 or php8-21.0.1)"
|
2020-02-01 01:34:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_image() {
|
|
|
|
IMAGE=$1
|
|
|
|
ARCH=$2
|
|
|
|
|
|
|
|
sed "s/BASE_TAG/${ARCH}-${NEXTCLOUD_RELEASE}-${VERSION}/g" "Dockerfile.${ARCH}" \
|
|
|
|
> "Dockerfile.${ARCH}.${NEXTCLOUD_RELEASE}.${VERSION}"
|
|
|
|
|
|
|
|
docker build \
|
|
|
|
--pull \
|
|
|
|
--no-cache \
|
|
|
|
-f "Dockerfile.${ARCH}.${NEXTCLOUD_RELEASE}.${VERSION}" \
|
|
|
|
-t "${IMAGE}:${NEXTCLOUD_RELEASE}-${VERSION}-${ARCH}" \
|
|
|
|
-t "${IMAGE}:latest-${ARCH}" \
|
|
|
|
-t "${IMAGE}:latest" \
|
|
|
|
.
|
|
|
|
|
|
|
|
docker push "${IMAGE}:${NEXTCLOUD_RELEASE}-${VERSION}-${ARCH}"
|
|
|
|
docker push "${IMAGE}:latest-${ARCH}"
|
|
|
|
docker push "${IMAGE}:latest"
|
|
|
|
|
|
|
|
rm "Dockerfile.${ARCH}.${NEXTCLOUD_RELEASE}.${VERSION}"
|
|
|
|
}
|
|
|
|
|
|
|
|
require "$VERSION" "version"
|
|
|
|
require "$NEXTCLOUD_RELEASE" "nextcloud release"
|
|
|
|
|
|
|
|
set -xe
|
|
|
|
|
|
|
|
build_image asonix/nextcloud arm64v8
|