docker/pixelfed/build.sh

53 lines
1.2 KiB
Bash
Raw Normal View History

2020-01-31 22:10:38 +00:00
#!/usr/bin/env bash
2020-01-30 04:11:32 +00:00
2020-01-31 22:10:38 +00:00
BUILD_DATE=$(date)
VERSION=$1
PIXELFED_RELEASE=$2
2020-01-30 04:11:32 +00:00
function require() {
2020-02-01 01:35:15 +00:00
if [ "$1" = "" ]; then
echo "input '$2' required"
print_help
exit 1
fi
2020-01-30 04:11:32 +00:00
}
function print_help() {
2020-02-01 01:35:15 +00:00
echo "build.sh"
echo ""
echo "Usage:"
echo " build.sh [version] [pixelfed_release]"
echo ""
echo "Args:"
echo " version: The version of the current container"
echo " pixelfed_release: The release of pixelfed to include"
2020-01-30 04:11:32 +00:00
}
2020-01-31 22:10:38 +00:00
function build_image() {
IMAGE=$1
ARCH=$2
docker build \
--pull \
--no-cache \
--build-arg BUILD_DATE="${BUILD_DATE}" \
--build-arg PIXELFED_RELEASE="${PIXELFED_RELEASE}" \
--build-arg VERSION="${VERSION}" \
-f "Dockerfile.${ARCH}" \
-t "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}" \
-t "${IMAGE}:latest-${ARCH}" \
-t "${IMAGE}:latest" \
.
docker push "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}"
docker push "${IMAGE}:latest-${ARCH}"
docker push "${IMAGE}:latest"
}
2020-01-30 04:11:32 +00:00
2020-01-31 22:10:38 +00:00
require "$VERSION" "version"
require "$PIXELFED_RELEASE" "pixelfed release"
2020-01-30 04:11:32 +00:00
2020-01-31 22:10:38 +00:00
set -xe
2020-01-30 04:11:32 +00:00
2020-01-31 22:10:38 +00:00
build_image asonix/pixelfed arm64v8