initial commit
This commit is contained in:
commit
072b1d0d06
23
paper/Dockerfile
Normal file
23
paper/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ARG JAVA=openjdk17
|
||||
RUN apk add --upgrade $JAVA curl jq
|
||||
|
||||
ADD ./bin /usr/local/bin
|
||||
|
||||
RUN adduser -D minecraft
|
||||
|
||||
RUN mkdir /minecraft && chown -R minecraft /minecraft
|
||||
|
||||
VOLUME ["/minecraft"]
|
||||
|
||||
WORKDIR /minecraft
|
||||
|
||||
USER minecraft
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ARG MC_VERSION
|
||||
ENV MC_VERSION=${MC_VERSION:-1.19.4}
|
||||
|
||||
CMD sh -c "download_mc $MC_VERSION && java -Xmx2G -Xms2G -jar paper.jar"
|
55
paper/bin/download_mc
Executable file
55
paper/bin/download_mc
Executable file
@ -0,0 +1,55 @@
|
||||
#!/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
|
||||
|
||||
meta_dir="docker_meta"
|
||||
|
||||
if test ! -f "$meta_dir/setup_done"; then
|
||||
# TODO: Use config/paper-global.yml with new config keys for 1.19+ Paper
|
||||
config_path="paper.yml"
|
||||
|
||||
config=""
|
||||
|
||||
if test "$VELOCITY_ENABLE" = "true"; then
|
||||
echo "online-mode=false" > server.properties
|
||||
|
||||
velocity=$(cat << EOF
|
||||
settings:
|
||||
velocity-support:
|
||||
enabled: true
|
||||
online-mode: true
|
||||
secret: '$VELOCITY_SECRET'
|
||||
EOF
|
||||
)
|
||||
|
||||
config="${config}${velocity}"
|
||||
fi
|
||||
|
||||
if test ! -z "$config"; then
|
||||
echo "Writing config"
|
||||
echo "$config" > $config_path
|
||||
fi
|
||||
|
||||
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
|
||||
else
|
||||
echo "Setup is done"
|
||||
fi
|
||||
|
||||
version=$1
|
||||
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
|
||||
|
||||
echo "eula=true" > eula.txt
|
23
paper/build_all_versions.sh
Executable file
23
paper/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_version="${versions[$version]}"
|
||||
echo $version $java_version
|
||||
docker build --build-arg MC_VERSION=$version --build-arg JAVA=$java_version -t mrletsplay/paper:$version .
|
||||
done
|
3
velocity-compose/.env
Normal file
3
velocity-compose/.env
Normal file
@ -0,0 +1,3 @@
|
||||
EULA=true
|
||||
VELOCITY_ENABLE=true
|
||||
VELOCITY_SECRET=REPLACE_THIS_WITH_A_RANDOM_SECRET
|
37
velocity-compose/docker-compose.yml
Normal file
37
velocity-compose/docker-compose.yml
Normal file
@ -0,0 +1,37 @@
|
||||
services:
|
||||
velocity:
|
||||
image: mrletsplay/velocity
|
||||
ports:
|
||||
- "25565:25577"
|
||||
volumes:
|
||||
- "./velocity:/velocity"
|
||||
networks:
|
||||
- velocity
|
||||
environment:
|
||||
- "VELOCITY_SECRET=${VELOCITY_SECRET}"
|
||||
server1:
|
||||
image: mrletsplay/paper:1.18.2
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- "./server1:/minecraft"
|
||||
networks:
|
||||
- velocity
|
||||
environment:
|
||||
- "EULA=${EULA}"
|
||||
- "VELOCITY_ENABLE=${VELOCITY_ENABLE}"
|
||||
- "VELOCITY_SECRET=${VELOCITY_SECRET}"
|
||||
server2:
|
||||
image: mrletsplay/paper:1.18.2
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- "./server2:/minecraft"
|
||||
networks:
|
||||
- velocity
|
||||
environment:
|
||||
- "EULA=${EULA}"
|
||||
- "VELOCITY_ENABLE=${VELOCITY_ENABLE}"
|
||||
- "VELOCITY_SECRET=${VELOCITY_SECRET}"
|
||||
networks:
|
||||
velocity:
|
19
velocity/Dockerfile
Normal file
19
velocity/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --upgrade openjdk17 curl jq
|
||||
|
||||
ADD ./bin /usr/local/bin
|
||||
|
||||
RUN adduser -D velocity
|
||||
|
||||
RUN mkdir /velocity && chown -R velocity /velocity
|
||||
|
||||
VOLUME ["/velocity"]
|
||||
|
||||
WORKDIR /velocity
|
||||
|
||||
USER velocity
|
||||
|
||||
EXPOSE 25577
|
||||
|
||||
CMD sh -c "download_velocity && java -Xmx500M -Xms500M -jar velocity.jar"
|
30
velocity/bin/download_velocity
Executable file
30
velocity/bin/download_velocity
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
meta_dir="docker_meta"
|
||||
|
||||
if test ! -f "$meta_dir/setup_done"; then
|
||||
if test "$VELOCITY_SECRET" = "REPLACE_THIS_WITH_A_RANDOM_SECRET"; then
|
||||
echo "Refusing to configure Velocity with insecure secret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$VELOCITY_SECRET" > forwarding.secret
|
||||
|
||||
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
|
||||
else
|
||||
echo "Setup is done"
|
||||
fi
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user