mirror of
https://github.com/apotdevin/thunderhub.git
synced 2026-08-13 12:33:08 +02:00
* feat: big cleanup and refactor * chore: fix config * chore: security stuff * chore: dep bumps * chore: more version bumps * chore: move to lucide icons * chore: change slider * chore: more stuff * chore: move component to shadcn * chore: remove numeral * chore: remove night theme * chore: move to sse * chore: cleanup deps * feat!: remove lnmarkets integration * feat!: remove rebalancing flow * chore: move to svg progress bar * chore: new toast lib * chore!: remove accounting report tool * chore: dependency updates * chore: donate button changes * chore: cleanup file * chore: cleanup * ci: build changes * fix: routing
124 lines
2.5 KiB
Bash
124 lines
2.5 KiB
Bash
#!/bin/sh
|
|
|
|
trap "exit" INT
|
|
|
|
REPO=apotdevin/thunderhub
|
|
BASE=base
|
|
TEST_MODE=false
|
|
|
|
# Parse flags
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--test) TEST_MODE=true; shift;;
|
|
*) echo "Unknown option: $1"; exit 1;;
|
|
esac
|
|
done
|
|
|
|
if [ "$TEST_MODE" = true ]; then
|
|
echo
|
|
echo "------------------------------------------"
|
|
echo "Test build (local, no push, no branch switch)"
|
|
echo "------------------------------------------"
|
|
echo
|
|
|
|
docker buildx create --name mybuilder --driver-opt network=host --use 2>/dev/null || true
|
|
|
|
START=`date +%s`
|
|
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag $REPO:test \
|
|
--file ./Dockerfile \
|
|
./
|
|
|
|
END=`date +%s`
|
|
RUNTIME=$((END-START))
|
|
|
|
echo
|
|
echo "------------------------------------------"
|
|
echo "DONE - Test build took $RUNTIME seconds"
|
|
echo "------------------------------------------"
|
|
echo
|
|
exit 0
|
|
fi
|
|
|
|
echo
|
|
echo
|
|
echo "------------------------------------------"
|
|
echo "Building multiarch image for" $REPO
|
|
echo "------------------------------------------"
|
|
echo
|
|
echo
|
|
|
|
git checkout master || exit
|
|
git pull || exit
|
|
|
|
VERSION=$(git describe --tags --abbrev=0 2>&1)
|
|
|
|
git checkout $VERSION || exit
|
|
|
|
NOT_LATEST=false
|
|
|
|
echo "Do you want to build images for version" $VERSION "?"
|
|
select yn in "Yes" "No" "Specify"; do
|
|
case $yn in
|
|
Yes ) break;;
|
|
Specify) NOT_LATEST=true; break;;
|
|
No ) exit;;
|
|
esac
|
|
done
|
|
|
|
if [ "$NOT_LATEST" = true ]; then
|
|
read -p "Enter the version you want to build: " VERSION
|
|
git checkout $VERSION || exit
|
|
fi
|
|
|
|
START=`date +%s`
|
|
|
|
docker buildx create --name mybuilder --driver-opt network=host --use 2>/dev/null || true
|
|
|
|
LATEST_TAGS=""
|
|
if [ "$NOT_LATEST" = false ]; then
|
|
LATEST_TAGS="--tag $REPO:latest"
|
|
fi
|
|
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag $REPO:$VERSION \
|
|
$LATEST_TAGS \
|
|
--file ./Dockerfile \
|
|
--push ./
|
|
|
|
END=`date +%s`
|
|
|
|
echo
|
|
echo
|
|
echo "Building basepath multiarch image for" $REPO
|
|
echo
|
|
echo
|
|
|
|
docker buildx build \
|
|
--build-arg BASE_PATH='/thub' \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag $REPO:$BASE-$VERSION \
|
|
--file ./Dockerfile \
|
|
--push ./
|
|
|
|
ENDBASE=`date +%s`
|
|
|
|
RUNTIME=$((END-START))
|
|
RUNTIME1=$((ENDBASE-END))
|
|
|
|
echo
|
|
echo
|
|
echo "------------------------------------------"
|
|
echo "DONE"
|
|
echo "------------------------------------------"
|
|
echo
|
|
echo
|
|
echo "Finished building and pushing images for" $REPO:$VERSION "and for" $REPO:$BASE-$VERSION
|
|
echo
|
|
echo "multiarch took" $RUNTIME "seconds"
|
|
echo "multiarch base took" $RUNTIME1 "seconds"
|
|
echo
|
|
echo
|