1
0
mirror of https://github.com/bplein/factorio-docker.git synced 2025-01-06 03:03:49 +02:00

use one main /factorio volume

This commit is contained in:
David Andersen 2016-10-26 23:15:09 +00:00
parent 2b63d0ef0e
commit ee3385959d
3 changed files with 26 additions and 14 deletions

View File

@ -14,11 +14,13 @@ RUN apk --update --no-cache add bash curl && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json && \
cp /opt/factorio/data/map-gen-settings.example.json /opt/factorio/data/map-gen-settings.json && \
apk --no-cache del curl
apk --no-cache del curl && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods && \
ln -s /factorio/config/server-settings.json /opt/factorio/data/server-settings.json && \
ln -s /factorio/config/map-gen-settings.json /opt/factorio/data/map-gen-settings.json
VOLUME /opt/factorio/saves /opt/factorio/mods
VOLUME /factorio
EXPOSE 34197/udp 27015/tcp

View File

@ -1,9 +1,22 @@
#!/bin/bash -x
set -e
SAVES=/opt/factorio/saves
mkdir -p /factorio/saves
mkdir -p /factorio/mods
mkdir -p /factorio/config
if [ ! -f /factorio/config/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json
fi
if [ ! -f /factorio/config/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json
fi
if ! find $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
#if [ -z $(find $SAVES -iname \*.zip -mindepth 1 -print | grep -q .) ]; then
/opt/factorio/bin/x64/factorio \
--create $SAVES/save.zip \
--map-gen-settings /opt/factorio/data/map-gen-settings.json

15
run.sh
View File

@ -1,12 +1,9 @@
mkdir -p /tmp/factorio
mkdir -p /tmp/factorio/mods
mkdir -p /tmp/factorio/saves
cp -n server-settings.example.json /tmp/factorio/server-settings.json
cp -n map-gen-settings.example.json /tmp/factorio/map-gen-settings.json
#mkdir -p /tmp/factorio/config
#mkdir -p /tmp/factorio/mods
#mkdir -p /tmp/factorio/saves
#cp -n server-settings.example.json /tmp/factorio/config/server-settings.json
#cp -n map-gen-settings.example.json /tmp/factorio/config/map-gen-settings.json
sudo docker run --rm -it \
-v /tmp/factorio/server-settings.json:/opt/factorio/data/server-settings.json \
-v /tmp/factorio/map-gen-settings.json:/opt/factorio/data/map-gen-settings.json \
-v /tmp/factorio/mods:/opt/factorio/mods \
-v /tmp/factorio/saves:/opt/factorio/saves \
-v /tmp/factorio:/factorio \
--name factorio \
factorio "$@"