images/minecraft/Dockerfile

33 lines
801 B
Text
Raw Normal View History

2024-06-06 21:27:05 +00:00
FROM alpine:3.19
# set environment
ENV LANG en_US.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk
ENV PATH=/usr/lib/jvm/java-21-openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# install packages
RUN apk add --no-cache tini wget openjdk21-jre jq curl shadow fontconfig ttf-dejavu
RUN rm -fr /var/cache/apk/*
# copy scripts
COPY ./mcjar /usr/local/bin/mcjar
COPY ./mclauncher /usr/local/bin/mclauncher
RUN chmod +x /usr/local/bin/mcjar
RUN chmod +x /usr/local/bin/mclauncher
# make user
RUN addgroup -S mc && adduser -S mc -G mc
RUN groupmod --gid 1000 mc
RUN usermod --uid 1000 mc
# make volumes
RUN mkdir /data && chown mc:mc /data
VOLUME /data
# final
USER mc
WORKDIR /data
ENV SERVER_DIR=/data
ENTRYPOINT ["/sbin/tini", "--" ]
CMD ["/usr/local/bin/mclauncher", "-l"]