GeyserDockerBuilder/build.sh

40 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
URL_BUILD='https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest'
echo "Getting Geyser last build infos..."
# get paper build version
if ! curl -L -s $URL_BUILD -o build_infos.json; then
echo -e "Error: Cant join API"
exit 1
fi
if ! jq -r '.version' -e < build_infos.json > /dev/null; then
echo -e "API returned an error"
exit 1
fi
GEYSER_VERSION=$(jq -r '.version' < build_infos.json)
GEYSER_BUILD=$(jq -r '.build' < build_infos.json)
echo "Geyser verion $GEYSER_VERSION build #$GEYSER_BUILD"
DOWNLOAD_URL=$URL_BUILD'/downloads/standalone'
RUNNABLE_JAR='Geyser-'$GEYSER_VERSION'-'$GEYSER_BUILD'.jar'
echo "Downloadling Geyser Standalone..."
echo "From "$DOWNLOAD_URL
echo "To "$RUNNABLE_JAR
curl -L -o $RUNNABLE_JAR $DOWNLOAD_URL
DOCKER_TAG="cr.pandacube.fr/geyser:"$GEYSER_VERSION"-"$GEYSER_BUILD
echo "Building docker image of Geyser Standalone "$DOCKER_TAG
docker build --build-arg RUNNABLE_JAR=$RUNNABLE_JAR -t $DOCKER_TAG .
echo "Pushing image to Pandacubes container registry"
docker push $DOCKER_TAG