Compare commits

..

3 Commits

Author SHA1 Message Date
2037324375
convert to "rootless"
All checks were successful
Docker Build and Push / build (push) Successful in 1m14s
2025-03-29 04:08:02 -04:00
e6b309d047
modify for "rootless" 2025-03-29 04:07:45 -04:00
d7af43f8b0
A little bit of formatting 2025-03-29 04:06:48 -04:00
3 changed files with 162 additions and 156 deletions

View File

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

View File

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

View File

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