Skip to content

Commit

Permalink
Merge pull request #2 from muebau/1.12
Browse files Browse the repository at this point in the history
fix to get 1.12 working again
  • Loading branch information
muebau authored Feb 16, 2019
2 parents ae7128d + 07243c0 commit c47ee29
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 19 deletions.
53 changes: 39 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
#
# Build Image
#

FROM ubuntu:18.04 as mapcrafter1.12-builder
MAINTAINER muebau <hb1c@gmx.net>

ENV DEBIAN_FRONTEND noninteractive

# Get dependency
RUN apt-get update && apt-get install -y libpng-dev libjpeg-turbo8 libboost-iostreams-dev git cmake build-essential libboost-all-dev libjpeg-dev

# Add the git repo and build it
RUN mkdir /git && cd /git && \
git clone --single-branch -n https://github.com/mapcrafter/mapcrafter.git && \
cd mapcrafter/ && git checkout 5aa16da59c5022a06fa01c24ab99b100b3c6bedb \
&& mkdir build && cd build && \
cmake .. && \
make && \
mkdir /tmp/mapcrafter && \
make DESTDIR=/tmp/mapcrafter install

#
# Final Image
#

FROM ubuntu:18.04
MAINTAINER muebau <hb1c@gmx.net>

Expand All @@ -8,26 +34,25 @@ VOLUME ["/config"]
VOLUME ["/output"]
VOLUME ["/world"]

RUN apt-get update && \
apt-get -y install python curl wget apt-transport-https cron imagemagick&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN echo "deb https://packages.mapcrafter.org/ubuntu zesty main" | tee "/etc/apt/sources.list.d/mapcrafter.list" && \
wget -O "/etc/apt/trusted.gpg.d/mapcrafter.gpg" "https://packages.mapcrafter.org/ubuntu/keyring.gpg"
# Mapcrafter, built in previous stage
COPY --from=mapcrafter1.12-builder /tmp/mapcrafter/ /

RUN apt-get update && \
apt-get -y install mapcrafter && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Depedencies needed for running Mapcrafter
RUN apt-get update && apt-get install -y cron \
libpng16-16 \
libjpeg-turbo-progs \
libboost-iostreams1.65.1 \
libboost-system1.65.1 \
libboost-filesystem1.65.1 \
libboost-program-options1.65.1 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
ldconfig

ADD crontab /etc/cron.d/mapcrafter-cron
RUN chmod 0644 /etc/cron.d/mapcrafter-cron
RUN touch /var/log/cron.log
RUN echo "container created" >> /var/log/cron.log

ADD render.sh /render
RUN chmod 0777 /render
ADD render.conf /

CMD cron && tail -f /var/log/cron.log
CMD cron -f
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
Docker container to run Mapcrafter https://mapcrafter.org

# Usage
## Minecraft 1.13 (and above)
```bash
docker run -d -v /path/to/output:/output -v /path/to/config:/config -v /path/to/world:/world:ro --name mapcrafter muebau/mapcrafter
docker run -d -v /path/to/output:/output -v /path/to/config:/config -v /path/to/world:/world:ro --name mapcrafter muebau/mapcrafter:1.13
```

## Minecraft 1.12 (and below)
```bash
docker run -d -v /path/to/output:/output -v /path/to/config:/config -v /path/to/world:/world:ro --name mapcrafter muebau/mapcrafter:1.12
```

# Volumes
Expand All @@ -13,7 +19,7 @@ There a three volumes:
The Minecraft "world" folder is expected here.

## /config
If a special config is needed it can be delivered here. If there is no `render.conf` present a simple one is genereted at first start.
If a special config is needed it can be delivered here. If there is no `render.conf` present a simple one is generated at first start.

## /output
The generated output is put here.
3 changes: 2 additions & 1 deletion crontab
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*/10 * * * * root /render
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
*/10 * * * * root /render > /proc/1/fd/1 2>/proc/1/fd/2
# Don't remove the empty line at the end of this file. It is required to run the cron job
5 changes: 3 additions & 2 deletions render.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
if [ ! -f /config/render.conf ]; then
echo "No config file found. Created a new one."
cp /render.conf /config/render.conf
fi

RUNNINGMAPCRAFTERS=$(pgrep -c mapcrafter)
if [ $RUNNINGMAPCRAFTERS == "0" ]; then
mapcrafter -c /config/render.conf -j 2 >> /var/log/cron.log 2>&1
mapcrafter -c /config/render.conf -j 2
else
echo "Found $RUNNINGMAPCRAFTERS instances of mapcrafter. So no new instance was started." >> /var/log/cron.log
echo "Found $RUNNINGMAPCRAFTERS instances of mapcrafter. So no new instance was started."
fi

0 comments on commit c47ee29

Please sign in to comment.