GeyserDockerBuilder/build.sh

42 lines
1.2 KiB
Bash

#!/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: Can't 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
DOCKER_TAG_LATEST="cr.pandacube.fr/geyser:latest"
echo "Building docker image of Geyser Standalone "$DOCKER_TAG
docker build --build-arg RUNNABLE_JAR=$RUNNABLE_JAR -t $DOCKER_TAG .
docker tag $DOCKER_TAG $DOCKER_TAG_LATEST
echo "Pushing image to Pandacube's container registry"
docker push $DOCKER_TAG
docker push $DOCKER_TAG_LATEST