From e31130c74bb52ccf5b9b6d7ca90b1e9b1f447e54 Mon Sep 17 00:00:00 2001 From: saibotk Date: Mon, 10 Jun 2019 02:00:34 +0200 Subject: [PATCH] A first and simple input->output container --- Dockerfile | 34 +++++++++++++++++++++++++++++++ files/docker-entrypoint.sh | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 Dockerfile create mode 100755 files/docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7ca7f88 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM openjdk:13-alpine + +MAINTAINER https://github.com/saibotk/BlockMap-Docker + +ARG USER=blockmap +ARG GROUP=blockmap +ARG PUID=844 +ARG PGID=844 + +ENV OUTPUT=/blockmap/output \ + INPUT_OVERWORLD=/blockmap/input/region \ + INPUT_NETHER=/blockmap/input/DIM1/region \ + INPUT_END=/blockmap/input/DIM-1/region \ + VERSION=1.3.0 \ + SHA1=cada13d8c9bba4a8dd1ed3017fd04a4a03695ca3 + +RUN mkdir -p /opt/blockmap /blockmap && \ + apk add --update --no-cache su-exec binutils gettext libintl && \ + apk add --update --no-cache --virtual .build-deps curl && \ + curl -sSL https://github.com/Minecraft-Technik-Wiki/BlockMap/releases/download/$VERSION/BlockMap-$VERSION.jar -o /opt/blockmap/BlockMap.jar && \ + echo "$SHA1 /opt/blockmap/BlockMap.jar" | sha1sum -c && \ + chmod ugo=rwx /opt/blockmap && \ + ln -s $INPUT_OVERWORLD /opt/blockmap/overworld && \ + ln -s $INPUT_NETHER /opt/blockmap/nether && \ + ln -s $INPUT_END /opt/blockmap/end && \ + ln -s $OUTPUT /opt/blockmap/output && \ + apk del .build-deps && \ + addgroup -g $PGID -S $GROUP && \ + adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \ + chown -R $USER:$GROUP /opt/blockmap /blockmap + +COPY files/ / + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/files/docker-entrypoint.sh b/files/docker-entrypoint.sh new file mode 100755 index 0000000..ecc7646 --- /dev/null +++ b/files/docker-entrypoint.sh @@ -0,0 +1,41 @@ +#!/bin/sh +x +# Stop this script on the first failure (e.g. cannot create the output folder) +set -e + +# This script renders one or more worlds with different settings. It is an example for how to use BlockMap in scripts. Adapt these +# variables to point to the required data for +# this to work. Further below are the actual render commands. Feel free to adapt them to your needs. +# +# The current configuration will render each dimension at least once, the overworld even multiple times (ocean ground view and +# cave view). All images are written to a different +# subfolder for each setting. + +WORLD_FOLDER_OVERWORLD=/opt/blockmap/overworld +WORLD_FOLDER_NETHER=/opt/blockmap/nether +WORLD_FOLDER_END=/opt/blockmap/end +OUTPUT_DIR=/opt/blockmap/output +BLOCKMAP_FILE=/opt/blockmap/BlockMap.jar + +# mkdir -p $OUTPUT_DIR +ls -l /opt/blockmap +# A simple and plain overworld view +echo "[INFO] Rendering overworld..." +mkdir -p $OUTPUT_DIR/overworld +java -jar $BLOCKMAP_FILE -v render -l -o=$OUTPUT_DIR/overworld $WORLD_FOLDER_OVERWORLD save --world-name="Overworld" --file="$OUTPUT_DIR/rendered.json" +# The ocean grounds of the overworld +echo "[INFO] Rendering overworld_ocean..." +mkdir -p $OUTPUT_DIR/overworld_ocean +java -jar $BLOCKMAP_FILE -v render -l -o=$OUTPUT_DIR/overworld_ocean -c=OCEAN_GROUND $WORLD_FOLDER_OVERWORLD save --world-name="Overworld (Ocean)" --file="$OUTPUT_DIR/rendered.json" +# All caves up to height 30 +echo "[INFO] Rendering overworld_cave..." +mkdir -p $OUTPUT_DIR/overworld_cave +java -jar $BLOCKMAP_FILE -v render -l -o=$OUTPUT_DIR/overworld_cave -c=CAVES --max-height=30 $WORLD_FOLDER_OVERWORLD save --world-name="Overworld (Cave)" --file="$OUTPUT_DIR/rendered.json" +# The nether up to height 64 +echo "[INFO] Rendering overworld_nether..." +mkdir -p $OUTPUT_DIR/overworld_nether +java -jar $BLOCKMAP_FILE -v render -l -o=$OUTPUT_DIR/nether --max-height=64 $WORLD_FOLDER_NETHER save --world-name="Nether" --file="$OUTPUT_DIR/rendered.json" +# A plain view of the end +echo "[INFO] Rendering overworld_end..." +mkdir -p $OUTPUT_DIR/overworld_end +java -jar $BLOCKMAP_FILE -v render -l -o=$OUTPUT_DIR/end $WORLD_FOLDER_END save --world-name="End" --file="$OUTPUT_DIR/rendered.json" +echo "[INFO] Rendering finished!"