Update docker images

This commit is contained in:
MrLetsplay 2023-04-23 12:57:32 +02:00
parent 712b0f0f03
commit 7f62ce4df6
6 changed files with 42 additions and 37 deletions

View File

@ -46,26 +46,13 @@ EOF
echo "eula=true" > eula.txt echo "eula=true" > eula.txt
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done" mkdir -p "$meta_dir" && touch "$meta_dir/config_done"
else else
echo "Configuration is done" echo "Configuration is done"
fi fi
if test "$PAPER_DONT_DOWNLOAD_ON_START" != "true"; then if test ! -f "paper.jar" -o "$PAPER_UPDATE_ON_START" == "true"; then
echo $MC_VERSION update_paper
version=$MC_VERSION
echo "Downloading version $version"
apiURL=https://api.papermc.io/v2/projects/paper
build=$(curl -X GET $apiURL/versions/$version/builds | jq -r ".builds[-1].build")
echo "Build is $build"
url=$apiURL/versions/$version/builds/$build/downloads/paper-$version-$build.jar
echo "Full URL is: $url"
echo "Downloading to $PWD"
wget -O paper.jar $url
else else
echo "Skipping Paper download" echo "Skipping Paper download"
fi fi

15
paper/bin/update_paper Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
version=$MC_VERSION
echo "Updating Paper version $version"
apiURL=https://api.papermc.io/v2/projects/paper
build=$(curl -X GET "$apiURL/versions/$version/builds" | jq -r ".builds[-1].build")
echo "Build is $build"
url="$apiURL/versions/$version/builds/$build/downloads/paper-$version-$build.jar"
echo "Full URL is: $url"
echo "Downloading to $PWD"
wget -O paper.jar "$url"

View File

@ -3,5 +3,5 @@ UID=1000
GID=1000 GID=1000
VELOCITY_ENABLE=true VELOCITY_ENABLE=true
VELOCITY_SECRET=REPLACE_THIS_WITH_A_RANDOM_SECRET VELOCITY_SECRET=REPLACE_THIS_WITH_A_RANDOM_SECRET
PAPER_DONT_DOWNLOAD_ON_START=false PAPER_UPDATE_ON_START=false
VELOCITY_DONT_DOWNLOAD_ON_START=false VELOCITY_UPDATE_ON_START=false

View File

@ -11,7 +11,7 @@ services:
- velocity - velocity
environment: environment:
- "VELOCITY_SECRET=${VELOCITY_SECRET}" - "VELOCITY_SECRET=${VELOCITY_SECRET}"
- "VELOCITY_DONT_DOWNLOAD_ON_START=${VELOCITY_DONT_DOWNLOAD_ON_START}" - "VELOCITY_UPDATE_ON_START=${VELOCITY_UPDATE_ON_START}"
server1: server1:
image: mrletsplay/paper:1.19.4 image: mrletsplay/paper:1.19.4
stdin_open: true stdin_open: true
@ -24,7 +24,7 @@ services:
- "EULA=${EULA}" - "EULA=${EULA}"
- "VELOCITY_ENABLE=${VELOCITY_ENABLE}" - "VELOCITY_ENABLE=${VELOCITY_ENABLE}"
- "VELOCITY_SECRET=${VELOCITY_SECRET}" - "VELOCITY_SECRET=${VELOCITY_SECRET}"
- "PAPER_DONT_DOWNLOAD_ON_START=${PAPER_DONT_DOWNLOAD_ON_START}" - "PAPER_UPDATE_ON_START=${PAPER_UPDATE_ON_START}"
server2: server2:
image: mrletsplay/paper:1.18.2 image: mrletsplay/paper:1.18.2
stdin_open: true stdin_open: true
@ -37,6 +37,6 @@ services:
- "EULA=${EULA}" - "EULA=${EULA}"
- "VELOCITY_ENABLE=${VELOCITY_ENABLE}" - "VELOCITY_ENABLE=${VELOCITY_ENABLE}"
- "VELOCITY_SECRET=${VELOCITY_SECRET}" - "VELOCITY_SECRET=${VELOCITY_SECRET}"
- "PAPER_DONT_DOWNLOAD_ON_START=${PAPER_DONT_DOWNLOAD_ON_START}" - "PAPER_UPDATE_ON_START=${PAPER_UPDATE_ON_START}"
networks: networks:
velocity: velocity:

View File

@ -2,25 +2,13 @@
meta_dir="docker_meta" meta_dir="docker_meta"
apiURL=https://api.papermc.io/v2/projects/velocity if test ! -f "velocity.jar" -o "$VELOCITY_UPDATE_ON_START" == "true"; then
update_velocity
if test "$VELOCITY_DONT_DOWNLOAD_ON_START" != "true"; then
version=$(curl -X GET $apiURL | jq -r ".versions[-1]")
echo "Version is $version"
build=$(curl -X GET $apiURL/versions/$version/builds | jq -r ".builds[-1].build")
echo "Build is $build"
url=$apiURL/versions/$version/builds/$build/downloads/velocity-$version-$build.jar
echo "Full URL is: $url"
echo "Downloading to $PWD"
wget -O velocity.jar $url
else else
echo "Skipping Velocity download" echo "Skipping Velocity download"
fi fi
if test ! -f "$meta_dir/setup_done"; then if test ! -f "$meta_dir/config_done"; then
if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then
echo "Refusing to configure Velocity with insecure secret" echo "Refusing to configure Velocity with insecure secret"
exit 1 exit 1
@ -33,7 +21,7 @@ if test ! -f "$meta_dir/setup_done"; then
echo shutdown | java -jar velocity.jar echo shutdown | java -jar velocity.jar
sed -i 's/player-info-forwarding-mode.*$/player-info-forwarding-mode = "MODERN"/g' velocity.toml sed -i 's/player-info-forwarding-mode.*$/player-info-forwarding-mode = "MODERN"/g' velocity.toml
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done" mkdir -p "$meta_dir" && touch "$meta_dir/config_done"
else else
echo "Setup is done" echo "Setup is done"
fi fi

15
velocity/bin/update_velocity Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
apiURL=https://api.papermc.io/v2/projects/velocity
version=$(curl -X GET $apiURL | jq -r ".versions[-1]")
echo "Version is $version"
build=$(curl -X GET "$apiURL/versions/$version/builds" | jq -r ".builds[-1].build")
echo "Build is $build"
url="$apiURL/versions/$version/builds/$build/downloads/velocity-$version-$build.jar"
echo "Full URL is: $url"
echo "Downloading to $PWD"
wget -O velocity.jar "$url"