Picsur/support/build.sh

28 lines
647 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-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
# 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"
docker build -t "$PACKAGE_URL:$VERSION" -t "$PACKAGE_URL:latest" -f ./picsur.Dockerfile ..
2022-02-25 15:41:56 +00:00
echo "Done"
# only push if argument is set to "push"
if [ "$1" == "push" ]; then
echo "Pushing to registry"
2022-02-25 15:41:56 +00:00
docker push "$PACKAGE_URL:$VERSION"
docker push "$PACKAGE_URL:latest"
2022-02-25 15:41:56 +00:00
echo "Done"
else
echo "Not pushing to registry"
fi