Skip to content

Commit 270a17b

Browse files
authored
change to openjdk:11-jre-slim base (#1)
run as minecraft user UID 200
1 parent a0b8740 commit 270a17b

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This also give you easy access to the items in the data folder to allow you to d
2323

2424
### Using Docker Compose
2525
Instead of remembering and typing long chains of parameters and docker options you can create a docker-compose.yml file
26-
(example [here](docker-compose.yml)) file
26+
(example [here](docker-compose.yml))
2727
and simply run the command `docker-compose up` to bring up the server with a specified data folder and then use the
2828
command `docker-compose down` to stop and get rid of the container. Later when you wish to restart the server you can
2929
run `docker-compose up` again and the world persisted on your local volume will be attached to a new container running a

docker/Dockerfile

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
1-
FROM azul/zulu-openjdk-alpine:8u212-jre
1+
FROM openjdk:11-jre-slim
22
MAINTAINER colincoleman
33

4-
RUN mkdir -p /home/minecraft/data
4+
RUN useradd -r -u 200 -m -c "minecraft account" -d /home/minecraft -s /bin/false minecraft
55

6-
COPY entrypoint.sh /home/minecraft/
6+
ADD https://launchermeta.mojang.com/mc/game/version_manifest.json /home/minecraft/version_manifest.json
77

8-
RUN apk update &&\
9-
apk add jq
8+
RUN apt-get update && \
9+
apt-get install -y \
10+
jq \
11+
wget && \
12+
LATESTVER=`cat /home/minecraft/version_manifest.json|jq -r .latest.release` &&\
13+
wget -O /home/minecraft/versionfile.json `cat /home/minecraft/version_manifest.json | jq -r ".versions[] | select(.id==\"$LATESTVER\")|.url"` &&\
14+
DOWNLOADURL=`cat /home/minecraft/versionfile.json |jq -r '.downloads.server.url'` &&\
15+
wget -O /home/minecraft/server.jar $DOWNLOADURL &&\
16+
apt-get remove -y \
17+
jq \
18+
wget && \
19+
rm -rf /var/lib/apt/lists/* && \
20+
mkdir /home/minecraft/data && \
21+
chown minecraft:minecraft /home/minecraft/data &&
1022

11-
ADD https://launchermeta.mojang.com/mc/game/version_manifest.json /home/minecraft/version_manifest.json
23+
USER minecraft
1224

13-
RUN LATESTVER=`cat /home/minecraft/version_manifest.json|jq -r .latest.release` &&\
14-
wget -O /home/minecraft/versionfile.json `cat /home/minecraft/version_manifest.json | jq -r ".versions[] | select(.id==\"$LATESTVER\")|.url"` &&\
15-
DOWNLOADURL=`cat /home/minecraft/versionfile.json |jq -r '.downloads.server.url'` &&\
16-
wget -O /home/minecraft/server.jar $DOWNLOADURL &&\
17-
echo "done"
25+
COPY entrypoint.sh /home/minecraft/
1826

1927
ENTRYPOINT ["/home/minecraft/entrypoint.sh"]

0 commit comments

Comments
 (0)