浏览代码

first version, basic functionality

tarfeef101 4 年之前
当前提交
9fefdc249f
共有 6 个文件被更改,包括 64 次插入0 次删除
  1. 4 0
      .gitignore
  2. 22 0
      Dockerfile
  3. 25 0
      README.md
  4. 0 0
      config/.gitkeep
  5. 13 0
      docker-compose.yaml
  6. 0 0
      worlds/.gitkeep

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+config/*
+!config/.gitkeep 
+worlds/*
+!worlds/.gitkeep 

+ 22 - 0
Dockerfile

@@ -0,0 +1,22 @@
+FROM openjdk:8-alpine
+
+WORKDIR /opt/
+
+ENV MIN_MEM=1 MAX_MEM=16
+
+# 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 && \
+    apk del curl && \
+    echo "eula=true" > eula.txt && \
+    mkdir config && \
+    touch config/server.properties config/ops.json config/whitelist.json config/banned-ips.json config/banned-players.json && \
+    ln -s config/server.properties server.properties && \
+    ln -s config/ops.json ops.json && \
+    ln -s config/whitelist.json whitelist.json && \
+    ln -s config/banned-ips.json banned-ips.json && \
+    ln -s config/banned-players.json banned-players.json
+
+CMD java -Xms${MIN_MEM}G -Xmx${MAX_MEM}G -jar server.jar nogui

+ 25 - 0
README.md

@@ -0,0 +1,25 @@
+# Dockerized Bedrock Server
+This project is a simple dockerized environment in which to run a minecraft java vanilla server. The main goals vs existing solutions are simple persistence (bind mounts to easily modify+backup world and config data), keeping a slim image (alpine based, minimal layers), and easy iterability (change one URL to rebuild to build a new version or texture pack).
+
+The Docker Hub page can be found at [this link]([https://hub.docker.com/repository/docker/tarfeef101/mc_java_vanilla](https://hub.docker.com/repository/docker/tarfeef101/mc_java_vanilla)).
+
+## Anatomy
+```
+.
+config/
+docker-compose.yaml
+Dockerfile
+README.md
+worlds/
+```
+### config/
+This directory is what will be bind-mounted into the container to house your config files. You should put your personalized, `banned-ips.json`, `banned-players.json`, `ops.json`, `server.properties`, and `whitelist.json` files in this directory.
+
+### docker-compose.yaml
+This file is what defines the runtime state of your container. This is a very simple setup, so just ensure to  select whatever port you wish to expose for your host port, and remember to keep this project in a folder mounted on a drive where you want those persisted directories to store data.
+
+### Dockerfile
+The Dockerfile tries to keep the image as simple and slim as possible. A slim base image is used to reduce size, minimal packages are installed, and all `RUN` commands are kept into one layer to reduce size.
+
+### 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.

+ 0 - 0
config/.gitkeep


+ 13 - 0
docker-compose.yaml

@@ -0,0 +1,13 @@
+version: '3'
+
+services:
+  minecraft:
+    build: .
+    image: mc_java_vanilla:alpine-1.8.9
+    container_name: mc_java
+    restart: on-failure
+    ports:
+      - "8008:25565"
+    volumes:
+      - "./worlds:/opt/worlds"
+      - "./config:/opt/config"

+ 0 - 0
worlds/.gitkeep