Explorar el Código

use compose build args for jar version, update docs

tarfeef101 hace 3 años
padre
commit
7f1e8e8a8d
Se han modificado 3 ficheros con 16 adiciones y 2 borrados
  1. 3 1
      Dockerfile
  2. 3 0
      README.md
  3. 10 1
      docker-compose.yaml

+ 3 - 1
Dockerfile

@@ -4,11 +4,13 @@ WORKDIR /opt/
 
 ENV MIN_MEM=1 MAX_MEM=16
 
+ARG JAR=https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
+
 # download+unpack & move configs to 1 folder
 # this allows for less volumes
 # ty @Roemer for the idea
 RUN apk add curl && \
-    curl -sSL https://launcher.mojang.com/v1/objects/b58b2ceb36e01bcd8dbf49c8fb66c55a9f0676cd/server.jar -o server.jar && \
+    curl -sSL $JAR -o server.jar && \
     apk del curl && \
     echo "eula=true" > eula.txt && \
     mkdir config && \

+ 3 - 0
README.md

@@ -23,3 +23,6 @@ The Dockerfile tries to keep the image as simple and slim as possible. A slim ba
 
 ### worlds/
 This is the bind-mounted directory which will house your world data. This should be empty unless you have a pre-existing world you want to import. If you want to add resource packs, this is the place to put them.
+
+## Building
+To build a new version, search for the JAR you're looking for at [MCVersions](https://mcversions.net/). Then, in the `docker-compose.yaml` file, set the `build` argument `JAR` to the URL of the file you wish to use. Then, run `docker-compose build` or `docker-compose up --build -d` (to just build, or build and start the server).

+ 10 - 1
docker-compose.yaml

@@ -3,11 +3,20 @@ version: '3'
 services:
   minecraft:
     build: .
-    image: mc_java_vanilla:alpine-1.8.9
+      context: .
+      args:
+        JAR: https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
+    image: mc_java_vanilla:alpine-1.15.2
     container_name: mc_java
     restart: on-failure
     ports:
       - "8008:25565"
     volumes:
       - "./worlds:/opt/worlds"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "200k"
+        max-file: "1"
+
       - "./config:/opt/config"