commit 22bb490237d71bb1acfd7cc4fd544ab27c7a334b Author: jreichmann <34141868+jreichmann@users.noreply.github.com> Date: Sat Mar 3 10:36:20 2018 +0100 Add Dockerfile and rough container file structure Added Dockerfile based on alpine:edge with the following packages: - curl - for downloading the server & querying for versions - jq - parsing JSON from bash Set up internal file structure of the container with scripts to download and run the server (unfinished) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b6362e1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:edge +MAINTAINER Jona Reichmann + +RUN apk update \ + && apk upgrade \ + && apk add \ + curl + jq + +ADD fsRoot / + +CMD ["bash", "-c", "/opt/minecraft/entrypoint.sh"] diff --git a/fsRoot/opt/minecraft/.downloadServer.sh.swp b/fsRoot/opt/minecraft/.downloadServer.sh.swp new file mode 100644 index 0000000..bcc9b40 Binary files /dev/null and b/fsRoot/opt/minecraft/.downloadServer.sh.swp differ diff --git a/fsRoot/opt/minecraft/downloadServer.sh b/fsRoot/opt/minecraft/downloadServer.sh new file mode 100644 index 0000000..651ca46 --- /dev/null +++ b/fsRoot/opt/minecraft/downloadServer.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +BASE_DOWNLOAD_URL="https://s3.amazonaws.com/Minecraft.Download/versions/" +VERSION_INFO_URL="https://launchermeta.mojang.com/mc/game/version_manifast.json" + +function query_latest_release() { + curl -s "$VERSION_INFO_URL" | jq -r '.latest.release' +} + +function query_latest_snapshot() { + curl -s "$VERSION_INFO_URL" | jq -r '.latest.snapshot' +} + +function download_version() { + local version="$1" + local url="${BASE_DOWNLOAD_URL}${version}/minecraft_server.${version}.jar" + curl -s -o "minecraft_server.jar" $url +} + diff --git a/fsRoot/opt/minecraft/entrypoint.sh b/fsRoot/opt/minecraft/entrypoint.sh new file mode 100644 index 0000000..e69de29