Picsur/support/build.sh

36 lines
801 B
Bash
Raw Normal View History

2022-02-25 15:41:56 +00:00
#!/bin/bash
2022-08-26 10:38:05 +00:00
PACKAGE_URL="ghcr.io/rubikscraft/picsur"
2022-09-02 10:23:18 +00:00
if [ "$1" == "alpha" ]; then
2022-09-06 14:32:16 +00:00
PACKAGE_URL="$PACKAGE_URL-alpha"
2022-09-02 10:23:18 +00:00
elif [ "$1" == "stable" ]; then
2022-09-06 14:32:16 +00:00
true
2022-09-02 10:23:18 +00:00
else
2022-09-06 14:32:16 +00:00
echo "Usage: $0 [alpha|stable]"
exit 1
2022-09-02 10:23:18 +00:00
fi
2022-02-25 15:41:56 +00:00
# Go to this script
2022-06-05 10:20:16 +00:00
cd "$(dirname "${BASH_SOURCE[0]}")"
2022-02-25 15:41:56 +00:00
2022-09-02 10:23:18 +00:00
# Install binfmt
docker run --privileged --rm tonistiigi/binfmt --install all
2022-02-25 15:41:56 +00:00
# Read current version from ../package.json
VERSION=$(cat ../package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
echo "Building version $VERSION"
2022-09-02 10:23:18 +00:00
docker buildx create --append --use --name picsur
2022-02-25 15:41:56 +00:00
2022-09-02 10:23:18 +00:00
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
-t "$PACKAGE_URL:$VERSION" \
-t "$PACKAGE_URL:latest" \
-f ./picsur.Dockerfile ..
2022-02-25 15:41:56 +00:00
2022-09-02 10:23:18 +00:00
echo "Done pushing $PACKAGE_URL:$VERSION"