Add Fabric image
This commit is contained in:
parent
75d8fe3ca1
commit
cdcf4fb386
25
fabric/Dockerfile
Normal file
25
fabric/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
|
||||
ARG JAVA=openjdk17
|
||||
RUN apk add --upgrade sudo shadow $JAVA curl jq
|
||||
|
||||
ADD ./bin /usr/local/bin
|
||||
|
||||
RUN useradd minecraft
|
||||
|
||||
RUN mkdir /minecraft && chown -R minecraft /minecraft
|
||||
|
||||
VOLUME ["/minecraft"]
|
||||
|
||||
WORKDIR /minecraft
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ARG MC_VERSION
|
||||
ENV MC_VERSION=${MC_VERSION:-1.19.4}
|
||||
|
||||
ENTRYPOINT ["setup"]
|
||||
CMD ["java", "-Xmx2G", "-Xms2G", "-jar", "fabric.jar"]
|
43
fabric/bin/configure_and_start
Executable file
43
fabric/bin/configure_and_start
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
meta_dir="docker_meta"
|
||||
|
||||
if test ! -f "$meta_dir/config_done"; then
|
||||
download_fabricproxy
|
||||
|
||||
mkdir -p config
|
||||
config_path="config/FabricProxy-Lite.toml"
|
||||
|
||||
config=""
|
||||
|
||||
if test "$VELOCITY_ENABLE" = "true"; then
|
||||
echo "online-mode=false" > server.properties
|
||||
|
||||
velocity=$(cat << EOF
|
||||
secret = "$VELOCITY_SECRET"
|
||||
EOF
|
||||
)
|
||||
|
||||
config="${config}${velocity}"
|
||||
fi
|
||||
|
||||
if test ! -z "$config"; then
|
||||
echo "Writing config to $config_path"
|
||||
echo "$config" > $config_path
|
||||
fi
|
||||
|
||||
echo "eula=true" > eula.txt
|
||||
|
||||
mkdir -p "$meta_dir" && touch "$meta_dir/config_done"
|
||||
else
|
||||
echo "Configuration is done"
|
||||
fi
|
||||
|
||||
if test ! -f "fabric.jar" -o "$FABRIC_UPDATE_ON_START" == "true"; then
|
||||
update_fabric
|
||||
else
|
||||
echo "Skipping Fabric download"
|
||||
fi
|
||||
|
||||
echo "> $@"
|
||||
exec "$@"
|
15
fabric/bin/download_fabricproxy
Executable file
15
fabric/bin/download_fabricproxy
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
version=$MC_VERSION
|
||||
echo "Downloading FabricProxy for version $version"
|
||||
|
||||
apiURL="https://api.modrinth.com/v2/project/fabricproxy-lite/version?loaders=%5B%22fabric%22%5D&game_versions=%5B%22$version%22%5D"
|
||||
|
||||
url=$(curl -X GET "$apiURL" | jq -r ".[0].files[0].url")
|
||||
echo "FabricProxy download URL: $url"
|
||||
|
||||
modFolder=$PWD/mods
|
||||
mkdir -p "$modFolder"
|
||||
|
||||
echo "Downloading to $modFolder"
|
||||
wget -O "$modFolder/FabricProxy.jar" "$url"
|
12
fabric/bin/setup
Executable file
12
fabric/bin/setup
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test "$EULA" != "true"; then
|
||||
echo "You need to accept the Mojang EULA (using -e EULA=true) to run the server"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usermod -u $UID minecraft
|
||||
groupmod -g $GID minecraft
|
||||
chown -R minecraft:minecraft /minecraft
|
||||
|
||||
exec sudo -E -u minecraft configure_and_start "$@"
|
18
fabric/bin/update_fabric
Executable file
18
fabric/bin/update_fabric
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
version=$MC_VERSION
|
||||
echo "Updating Fabric version $version"
|
||||
|
||||
apiURL=https://meta.fabricmc.net/v2/versions
|
||||
|
||||
latestLoader=$(curl -X GET "$apiURL/loader" | jq -r ".[0].version")
|
||||
echo "Latest loader: $latestLoader"
|
||||
|
||||
latestInstaller=$(curl -X GET "$apiURL/installer" | jq -r ".[0].version")
|
||||
echo "Latest installer: $latestInstaller"
|
||||
|
||||
url="$apiURL/loader/$version/$latestLoader/$latestInstaller/server/jar"
|
||||
echo "Full URL is: $url"
|
||||
|
||||
echo "Downloading to $PWD"
|
||||
wget -O fabric.jar "$url"
|
23
fabric/build_all_versions.sh
Executable file
23
fabric/build_all_versions.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
declare -A versions
|
||||
#versions["1.8.8"]="openjdk8"
|
||||
#versions["1.9.4"]="openjdk8"
|
||||
#versions["1.10.2"]="openjdk8"
|
||||
#versions["1.11.2"]="openjdk8"
|
||||
#versions["1.12.2"]="openjdk8"
|
||||
#versions["1.13.2"]="openjdk8"
|
||||
versions["1.14.4"]="openjdk8"
|
||||
versions["1.15.2"]="openjdk8"
|
||||
versions["1.16.5"]="openjdk8"
|
||||
versions["1.17.1"]="openjdk8"
|
||||
versions["1.18.2"]="openjdk17"
|
||||
versions["1.19.4"]="openjdk17"
|
||||
|
||||
for version in "${!versions[@]}"; do
|
||||
java=${versions[$version]}
|
||||
echo "Building version $version, JAVA=$java"
|
||||
docker build --build-arg MC_VERSION=$version --build-arg JAVA=$java -t mrletsplay/fabric:$version .
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user