File size: 1,253 Bytes
29024f5
 
 
 
 
4772c53
 
 
 
 
 
29024f5
 
 
4772c53
29024f5
 
4772c53
 
e439c60
4772c53
 
f2dc2b5
4772c53
 
f2dc2b5
4772c53
 
 
 
29024f5
4772c53
 
 
 
 
29024f5
4772c53
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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"]