Skip to content
This repository was archived by the owner on May 20, 2021. It is now read-only.

Commit 02475cd

Browse files
authored
Merge pull request #22 from marblenix/patch-1
Become version agnostic
2 parents af2d8e6 + b567146 commit 02475cd

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Dockerfile

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Minecraft 1.11 Dockerfile - Example with notes
22

3-
# Use the offical Debian Docker image with a specified version tag, Jessie, so not all
3+
# Use the offical Debian Docker image with a specified version tag, Stretch, so not all
44
# versions of Debian images are downloaded.
5-
FROM debian:jessie
5+
FROM debian:stretch
66

77
MAINTAINER Michael Chiang <[email protected]>
88

9-
# Drives which version we are going to install
10-
ENV MINECRAFT_VERSION 1.13.2
9+
# Simple utility for download a specific version of the minecraft server.jar
10+
ENV MINECRAFT_UTILITY https://github.com/marblenix/minecraft_downloader/releases/download/20190324-f1427be/minecraft_downloader_linux
11+
# Version of minecraft to download
12+
ENV MINECRAFT_VERSION latest
1113

1214
# Use APT (Advanced Packaging Tool) built in the Linux distro to download Java, a dependency
1315
# to run Minecraft.
@@ -16,10 +18,11 @@ ENV MINECRAFT_VERSION 1.13.2
1618
# Then we pull in all of our dependencies,
1719
# Finally, we download the correct .jar file using wget
1820
# .jar file fetched from the official page https://minecraft.net/en-us/download/server/
19-
RUN echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list; \
20-
apt-get -y update; \
21-
apt install -y -t jessie-backports openjdk-8-jre-headless ca-certificates-java wget; \
22-
wget -q https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar -O /minecraft_server.${MINECRAFT_VERSION}.jar;
21+
RUN apt update; \
22+
apt install -y default-jre ca-certificates-java curl; \
23+
curl -sL "${MINECRAFT_UTILITY}" -o minecraft_downloader; \
24+
chmod +x ./minecraft_downloader; \
25+
./minecraft_downloader -o minecraft_server_${MINECRAFT_VERSION}.jar;
2326
# We do the above in a single line to reduce the number of layers in our container
2427

2528
# Sets working directory for the CMD instruction (also works for RUN, ENTRYPOINT commands)
@@ -31,4 +34,4 @@ VOLUME /data
3134
EXPOSE 25565
3235

3336
#Automatically accept Minecraft EULA, and start Minecraft server
34-
CMD echo eula=true > /data/eula.txt && java -jar /minecraft_server.${MINECRAFT_VERSION}.jar
37+
CMD echo eula=true > /data/eula.txt && java -jar /minecraft_server_${MINECRAFT_VERSION}.jar

0 commit comments

Comments
 (0)