use sh instead of bash

This commit is contained in:
David Andersen 2016-11-01 20:31:24 +00:00
parent ea4843498b
commit 8222bd1b45
2 changed files with 17 additions and 18 deletions

View File

@ -7,18 +7,16 @@ COPY ./factorio.crt /opt/factorio.crt
ENV VERSION=0.14.17 \ ENV VERSION=0.14.17 \
SHA1=ffb248fabed345aafadb6a8cdef3684312ac240f SHA1=ffb248fabed345aafadb6a8cdef3684312ac240f
RUN apk --update --no-cache add bash curl tini pwgen && \ RUN apk --no-cache add curl tini pwgen && \
curl -sSL --cacert /opt/factorio.crt \ curl -sSL --cacert /opt/factorio.crt \
https://www.factorio.com/get-download/$VERSION/headless/linux64 \ https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \ -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
echo "$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 --directory /opt && \ 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 && \
apk --no-cache del curl && \ apk del curl && \
ln -s /factorio/saves /opt/factorio/saves && \ ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods && \ 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 /factorio VOLUME /factorio

View File

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