Configurable UID and GID
This commit is contained in:
parent
6bde53aa04
commit
5899a9b7aa
@ -1,11 +1,15 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
|
||||
ARG JAVA=openjdk17
|
||||
RUN apk add --upgrade $JAVA curl jq
|
||||
RUN apk add --upgrade sudo shadow $JAVA curl jq
|
||||
|
||||
ADD ./bin /usr/local/bin
|
||||
|
||||
RUN adduser -D minecraft
|
||||
RUN groupadd -g $GID minecraft
|
||||
RUN useradd -u $UID -g $GID minecraft
|
||||
|
||||
RUN mkdir /minecraft && chown -R minecraft /minecraft
|
||||
|
||||
@ -13,11 +17,10 @@ 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"
|
||||
ENTRYPOINT ["setup"]
|
||||
CMD ["java", "-Xmx2G", "-Xms2G", "-jar", "paper.jar"]
|
||||
|
@ -1,13 +1,8 @@
|
||||
#!/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
|
||||
if test ! -f "$meta_dir/config_done"; then
|
||||
# TODO: Use config/paper-global.yml with new config keys for 1.19+ Paper
|
||||
config_path="paper.yml"
|
||||
|
||||
@ -35,10 +30,11 @@ EOF
|
||||
|
||||
mkdir -p "$meta_dir" && touch "$meta_dir/setup_done"
|
||||
else
|
||||
echo "Setup is done"
|
||||
echo "Configuration is done"
|
||||
fi
|
||||
|
||||
version=$1
|
||||
echo $MC_VERSION
|
||||
version=$MC_VERSION
|
||||
echo "Downloading version $version"
|
||||
|
||||
apiURL=https://api.papermc.io/v2/projects/paper
|
||||
@ -53,3 +49,6 @@ echo "Downloading to $PWD"
|
||||
wget -O paper.jar $url
|
||||
|
||||
echo "eula=true" > eula.txt
|
||||
|
||||
echo "> $@"
|
||||
exec "$@"
|
12
paper/bin/setup
Executable file
12
paper/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 "$@"
|
@ -1,10 +1,14 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --upgrade openjdk17 curl jq
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
|
||||
RUN apk add --upgrade sudo shadow openjdk17 curl jq
|
||||
|
||||
ADD ./bin /usr/local/bin
|
||||
|
||||
RUN adduser -D velocity
|
||||
RUN groupadd -g $GID velocity
|
||||
RUN useradd -u $UID -g $GID velocity
|
||||
|
||||
RUN mkdir /velocity && chown -R velocity /velocity
|
||||
|
||||
@ -12,8 +16,7 @@ VOLUME ["/velocity"]
|
||||
|
||||
WORKDIR /velocity
|
||||
|
||||
USER velocity
|
||||
|
||||
EXPOSE 25577
|
||||
|
||||
CMD sh -c "download_velocity && java -Xmx500M -Xms500M -jar velocity.jar"
|
||||
ENTRYPOINT ["setup"]
|
||||
CMD ["java", "-Xmx500M", "-Xms500M", "-jar", "velocity.jar"]
|
||||
|
@ -28,3 +28,6 @@ echo "Full URL is: $url"
|
||||
|
||||
echo "Downloading to $PWD"
|
||||
wget -O velocity.jar $url
|
||||
|
||||
echo "> $@"
|
||||
exec "$@"
|
7
velocity/bin/setup
Executable file
7
velocity/bin/setup
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
usermod -u $UID velocity
|
||||
groupmod -g $GID velocity
|
||||
chown -R velocity:velocity /velocity
|
||||
|
||||
exec sudo -E -u velocity configure_and_start "$@"
|
Loading…
x
Reference in New Issue
Block a user