-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (24 loc) · 1.28 KB
/
Dockerfile
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
# Uses the Amazon Corretto 17 image that contains the Java 17 JDK
FROM amazoncorretto:17
# Set the working directory to /games/minecraft-server
WORKDIR /games/minecraft-server
# Installs wget and nano to manage the server easily
RUN yum install -y wget && yum install -y nano
# Download the server from Mojang Official Website
RUN wget https://piston-data.mojang.com/v1/objects/84194a2f286ef7c14ed7ce0090dba59902951553/server.jar
# Generates the server properties and the eula to configure the server
RUN java -Xmx256M -Xms256M -jar server.jar
# Change the server max players to 100
RUN sed -i -e 's/max-players=20/max-players=100/g' server.properties
# Change the server name to Dockerized Minecraft
RUN sed -i -e 's/motd=A Minecraft Server/motd=Dockerized Minecraft/g' server.properties
# Download the server icon that will be displayed in the server list
RUN wget -O server-icon.png https://www.iconarchive.com/download/i106016/papirus-team/papirus-apps/minecraft.64.png
# Accepts the EULA, you should read it before running the server
RUN echo "eula=true" > eula.txt
# Runs the server in the background
CMD java -Xmx2048M -Xms1024M -jar server.jar nogui
# Exposes the port 25565 to the host
# Remember to use -p 25565:25565 when running
# the container in order to expose the port
EXPOSE 25565