added 0.16

This commit is contained in:
David Andersen 2017-12-13 08:50:16 -08:00
parent e2e7cc7798
commit 1ce5c5db7e
3 changed files with 86 additions and 0 deletions

35
0.16/Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM frolvlad/alpine-glibc:alpine-3.6
MAINTAINER https://github.com/dtandersen/docker_factorio_server
ENV PORT=34197 \
RCON_PORT=27015 \
VERSION=0.15.40 \
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
VOLUME /factorio
RUN mkdir /opt && \
apk add --update --no-cache tini pwgen && \
apk add --update --no-cache --virtual .build-deps curl && \
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
chmod -R ugo=rwx /opt/factorio && \
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods && \
apk del .build-deps && \
addgroup -g 845 -S fdaemon && \
adduser -u 845 -G fdaemon -s /bin/sh -SDH fdaemon && \
chown -R fdaemon:fdaemon /opt/factorio /factorio
USER fdaemon
EXPOSE $PORT/udp $RCON_PORT/tcp
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/docker-entrypoint.sh"]

8
0.16/docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: '2'
services:
factorio:
build: .
ports:
- "34197:34197"
volumes:
- /tmp/factorio:/factorio

43
0.16/docker-entrypoint.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh -x
set -e
SAVES=/factorio/saves
CONFIG=/factorio/config
mkdir -p $SAVES
mkdir -p /factorio/mods
mkdir -p $CONFIG
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
fi
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
/opt/factorio/bin/x64/factorio \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json \
--map-settings $CONFIG/map-settings.json
fi
exec /opt/factorio/bin/x64/factorio \
--port $PORT \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--server-whitelist $CONFIG/server-whitelist.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--rcon-password "$(cat $CONFIG/rconpw)" \
--server-id /factorio/config/server-id.json