Merge pull request 'feature-42-image-size-optimization-and-uid-gid-selection' (#3) from feature-42 into develop
All checks were successful
/ build-docker (push) Successful in 7m20s

Reviewed-on: #3
This commit is contained in:
cuqmbr 2025-08-12 19:34:13 +00:00
commit 652f3896f9

View File

@ -15,20 +15,36 @@ RUN mkdir ${DATA_PATH}/logs && \
# Generate unicode locale so that cyrillic characters display properly
RUN apt-get update -y && apt-get install -y locales && \
echo en_US.UTF-8 UTF-8 > /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales
dpkg-reconfigure --frontend=noninteractive locales && \
rm -Rf var/lib/apt/lists/*
ENV LANG en_US.UTF-8
VOLUME ${DATA_PATH}
EXPOSE 25565/tcp
ENV MEMORY=1G
ENV PROXY_SECRET=change_me
WORKDIR ${WORKDIR_PATH}/config
EXPOSE 25565/tcp
CMD \
# Create and switch to user with desired UID and GID.
# All processes that create/change files in ${DATA_PATH}
# must be run under this user.
groupadd -g ${GID} worker && \
useradd -M -g ${GID} -u ${UID} worker && \
chmod -R o-rwx ${WORKDIR_PATH} && \
# Add proxy secret
sed -i "s/_PROXY_SECRET_/${PROXY_SECRET}/g" settings.yml && \
java -Xms${MEMORY} -Xmx${MEMORY} -jar *.jar --nogui
# Change UID and GID of used files to desired values.
chown -R worker:worker ${WORKDIR_PATH} && \
# Launch
su worker -c "java -Xms${MEMORY} -Xmx${MEMORY} -jar *.jar --nogui"