change Eula handling, disable server start
All checks were successful
Docker Build and Push / build (push) Successful in 1m6s

This commit is contained in:
Jeremy McClure 2025-03-29 06:11:18 -04:00
parent 2037324375
commit cff62979ff
Signed by: jeremy
GPG Key ID: CA27BD8443157067
4 changed files with 40 additions and 10 deletions

View File

@ -8,13 +8,14 @@ ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install prerequisites
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
jq \
libxml2-utils \
sudo && \
sudo \
tini && \
apt-get autoremove && apt-get clean && \
rm -rf /var/lib/apt/lists/*
@ -33,4 +34,5 @@ RUN chmod +x /init && chmod +x /usr/local/bin/mc
USER minecraft
CMD ["/init"]
ENTRYPOINT ["tini", "--", "/init"]

View File

@ -11,7 +11,6 @@ services:
- JAR=server.jar
- MEMORY=2G
- ADD_ARGS=
- RESTART=true
build:
dockerfile: Dockerfile
context: .

View File

@ -1,5 +1,13 @@
#!/bin/env bash
JAVA_VERSION=${JAVA_VERSION:-"temurin@21"}
PATH=${JAVA_HOME}/bin:$PATH
JAVA_HOME=/data/java/${JAVA_VERSION}
JAR=server.jar
ADD_ARGS=${ADD_ARGS:-""}
MEM=${MEMORY:-2G}
PUID="${PUID:-1000}"
PGID="${PGID:-1000}"
@ -8,11 +16,32 @@ setperms() {
sudo usermod -u ${PUID} minecraft >/dev/null 2>&1
sudo groupmod -g ${PGID} minecraft >/dev/null 2>&1
sudo chown -R ${PUID}:${PGID} /data >/dev/null 2>&1
sleep 2
echo "DONE"
sleep 2
}
buildCommand() {
JAVA_ARGS="-Xms${MEM} -Xmx${MEM}"
if [[ -z ${ADD_ARGS+x} ]]; then
RUN_STRING="${ADD_ARGS} ${JAVA_ARGS} -jar ${JAR} nogui"
else
RUN_STRING="${JAVA_ARGS} -jar ${JAR} nogui"
fi
}
setperms
mc
buildCommand
cd /data/server
if [[ -f "server.jar" ]]; then
echo "$JAVA_HOME/bin/java $RUN_STRING"
exec $JAVA_HOME/bin/java $RUN_STRING
else
echo "Server Not Found."
exit 1
fi

View File

@ -16,10 +16,8 @@ crash() {
}
setEula() {
if [[ ! -s "eula.txt" ]]; then
echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA)." >eula.txt
echo "eula=true" >>eula.txt
fi
echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA)." >eula.txt
echo "eula=true" >>eula.txt
}
javaCheck() {
@ -157,4 +155,6 @@ javaCheck
serverSelect
runServer
setEula
#runServer