Compare commits

..

No commits in common. "2037324375389c60b536589b4f93ce346ce8ec5d" and "e04bf4ef57ef9329ec681f0e62a38c4af7889795" have entirely different histories.

3 changed files with 156 additions and 162 deletions

View File

@ -1,36 +1,32 @@
FROM ubuntu:noble FROM ubuntu:noble
ARG UID=1000
ARG GID=1000
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install prerequisites # install prerequisites
RUN apt-get update \ RUN apt update \
&& apt-get install -y --no-install-recommends \ && apt install -y --no-install-recommends \
curl \ curl ca-certificates \
ca-certificates \
jq \ jq \
libxml2-utils \ libxml2-utils \
sudo && \ && apt autoremove \
apt-get autoremove && apt-get clean && \ && apt clean \
rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Remove default ubuntu user # Remove default ubuntu user
RUN userdel -r ubuntu && \ RUN userdel -r ubuntu \
useradd --create-home -u 1000 minecraft && \ && useradd --create-home -u 1000 minecraft \
echo 'minecraft ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ && mkdir -p /data \
mkdir -p /data && \ && chown -R 1000:1000 /data
chown -R ${UID}:${GID} /data
RUN su -c "curl -sL https://github.com/Jabba-Team/jabba/raw/main/install.sh | bash && . ~/.jabba/jabba.sh" minecraft USER minecraft
RUN curl -sL https://github.com/Jabba-Team/jabba/raw/main/install.sh | bash \
&& . ~/.jabba/jabba.sh
USER root
COPY ./scripts/init / COPY ./scripts/init /
COPY ./scripts/mc /usr/local/bin COPY ./scripts/mc /usr/local/bin
RUN chmod +x /init && chmod +x /usr/local/bin/mc RUN chmod +x /init && chmod +x /usr/local/bin/mc
USER minecraft
CMD ["/init"] CMD ["/init"]

View File

@ -5,14 +5,12 @@ PGID="${PGID:-1000}"
setperms(){ setperms(){
echo "Setting permissions to UID:${PUID} and GID:${PGID}" echo "Setting permissions to UID:${PUID} and GID:${PGID}"
sudo usermod -u ${PUID} minecraft >/dev/null 2>&1 usermod -u ${PUID} minecraft > /dev/null 2>&1
sudo groupmod -g ${PGID} minecraft >/dev/null 2>&1 groupmod -g ${PGID} minecraft > /dev/null 2>&1
sudo chown -R ${PUID}:${PGID} /data >/dev/null 2>&1 chown -R ${PUID}:${PGID} /data > /dev/null 2>&1
echo "DONE"
sleep 2 sleep 2
} }
setperms setperms
mc su -c "mc" minecraft

View File

@ -1,14 +1,14 @@
#!/bin/env bash #!/bin/env bash
MC_LOADER="${MC_LOADER:-"paper"}" MC_LOADER="${MC_LOADER:="paper"}"
MC_VERSION=${MC_VERSION:-"1.21.4"} MC_VERSION=${MC_VERSION:="1.21.4"}
JAVA_VERSION=${JAVA_VERSION:-"temurin@21"} JAVA_VERSION=${JAVA_VERSION:="temurin@21"}
JAR=${JAR:-"server.jar"} JAR=${JAR:="server.jar"}
MEM=${MEMORY:-2G} MEM=${MEMORY:=2G}
ADD_ARGS=${ADD_ARGS:-""} ADD_ARGS=${ADD_ARGS:=""}
RESTART=${RESTART:-"true"} RESTART=${RESTART:="true"}
crash() { crash() {
sleep 5 sleep 5