temp0 / Dockerfile
motoe moto
Update Dockerfile
4772c53 verified
# Use Ubuntu as the base image
FROM ubuntu:latest
# Set environment variables for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
ENV MC_SERVER_FILE=purpur-1.18.2-1632.jar
ENV MC_SERVER_URL=https://dev-motoemoto47ark123-dl-server-1.hf.space/files/${MC_SERVER_FILE}
ENV PLUGIN_FILE=playit-minecraft-plugin.jar
ENV PLUGIN_URL=https://dev-motoemoto47ark123-dl-server-1.hf.space/files/${PLUGIN_FILE}
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
# Install necessary packages
RUN apt-get update && \
apt-get install -y wget openjdk-17-jdk && \
apt-get clean
# Set the working directory
WORKDIR $HOME/app
# Download the Minecraft server JAR file
RUN wget -O ${MC_SERVER_FILE} ${MC_SERVER_URL}
# Accept the Minecraft EULA by creating the eula.txt file
RUN echo "eula=true" > eula.txt
# Create necessary directories and set permissions
RUN mkdir -p $HOME/app/plugins && \
chown -R 1000:1000 $HOME/app && \
chmod -R 777 $HOME/app
# Download the plugin file
RUN wget -O $HOME/app/plugins/${PLUGIN_FILE} ${PLUGIN_URL}
# Expose the default Minecraft server port
EXPOSE 25565
# Set the entrypoint to run the Minecraft server with 16GB of RAM
CMD ["java", "-Xmx16G", "-Xms16G", "-jar", "${MC_SERVER_FILE}", "nogui"]