use server-settings.json for settings

This commit is contained in:
David Andersen 2016-10-25 16:49:23 +00:00
parent be4c89d937
commit 65658b10d6
2 changed files with 19 additions and 50 deletions

View File

@ -1,28 +1,25 @@
FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23 FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23
MAINTAINER zopanix <zopanix@gmail.com> MAINTAINER https://github.com/dtandersen/docker_factorio_server
WORKDIR /opt #WORKDIR /opt
COPY ./smart_launch.sh /opt COPY ./factorio.crt /opt/factorio.crt
COPY ./factorio.crt /opt
VOLUME /opt/factorio/saves /opt/factorio/mods EXPOSE 34197/udp 27015/tcp
ENV FACTORIO_AUTOSAVE_INTERVAL=2 \
FACTORIO_AUTOSAVE_SLOTS=3 \ ENV VERSION=0.14.14 \
FACTORIO_DISSALOW_COMMANDS=true \ SHA1=decd1ef34a75b309791e65bc92b164f10479753b
FACTORIO_NO_AUTO_PAUSE=false \
VERSION=0.14.14 \
FACTORIO_SHA1=decd1ef34a75b309791e65bc92b164f10479753b
RUN apk --update add bash curl && \ RUN apk --update add bash curl && \
curl -sSL --cacert /opt/factorio.crt https://www.factorio.com/get-download/$VERSION/headless/linux64 -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \ curl -sSL --cacert /opt/factorio.crt https://www.factorio.com/get-download/$VERSION/headless/linux64 -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
echo "$FACTORIO_SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \ echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz && \ tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
rm /tmp/factorio_headless_x64_$VERSION.tar.gz rm /tmp/factorio_headless_x64_$VERSION.tar.gz
VOLUME /opt/factorio/saves /opt/factorio/mods
EXPOSE 34197/udp COPY ./smart_launch.sh /opt
CMD ["./smart_launch.sh"] CMD ["/opt/smart_launch.sh"]

View File

@ -1,43 +1,15 @@
#!/bin/bash #!/bin/bash -x
if [ -f /opt/factorio/saves/save.zip ] SAVES=/opt/factorio/saves
if [ -f $SAVES/*.zip ]
then then
echo "###" last_save=$(ls $SAVES -lt | grep save |head -1 |awk '{print $(NF)}')
echo "# Using existing map [save.zip]"
echo "###"
echo "###"
echo "# Finding latest map"
echo "###"
last_save=$(ls /opt/factorio/saves -lt | grep save |head -1 |awk '{print $(NF)}')
else else
echo "###"
echo "# Creating a new map [save.zip]"
echo "###"
/opt/factorio/bin/x64/factorio --create save.zip
last_save="save.zip" last_save="save.zip"
echo "###" /opt/factorio/bin/x64/factorio --create $SAVES/$last_save
echo "# New map created [save.zip]"
echo "###"
fi fi
# Checking options
if [ "$FACTORIO_DISSALOW_COMMANDS" == false ]; then
disallow_commands=""
else
disallow_commands="--disallow-commands"
fi
if [ "$FACTORIO_NO_AUTO_PAUSE" == true ]; then
no_auto_pause="--no-auto-pause"
else
no_auto_pause=""
fi
echo "###"
echo "# Launching Game"
echo "###"
exec /opt/factorio/bin/x64/factorio \ exec /opt/factorio/bin/x64/factorio \
$disallow_commands \
$no_auto_pause \
--autosave-interval ${FACTORIO_AUTOSAVE_INTERVAL} \
--autosave-slots ${FACTORIO_AUTOSAVE_SLOTS} \
--start-server \ --start-server \
$last_save $SAVES/$last_save