1
0
mirror of https://github.com/factoriotools/factorio-docker.git synced 2024-11-28 08:38:47 +02:00

preparation for 0.15

This commit is contained in:
David Andersen 2017-04-24 09:00:45 -07:00
parent be99942271
commit 548f9b27d0
5 changed files with 68 additions and 0 deletions

26
0.15/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM frolvlad/alpine-glibc:alpine-3.4
MAINTAINER https://github.com/dtandersen/docker_factorio_server
ENV VERSION=0.14.22 \
SHA1=c43fa0d750e8347ec466ce165053db3cd3dc2fe0
RUN mkdir /opt && \
apk --no-cache add curl tini pwgen && \
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
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 && \
apk del curl && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods
VOLUME /factorio
EXPOSE 34197/udp 27015/tcp
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/docker-entrypoint.sh"]

1
0.15/build.sh Normal file
View File

@ -0,0 +1 @@
sudo docker build --no-cache -t factorio .

1
0.15/clean.sh Normal file
View File

@ -0,0 +1 @@
sudo rm -rf /tmp/factorio

35
0.15/docker-entrypoint.sh Normal file
View File

@ -0,0 +1,35 @@
#!/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 ! 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
fi
exec /opt/factorio/bin/x64/factorio \
--port 34197 \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--rcon-port 27015 \
--rcon-password "$(cat $CONFIG/rconpw)"

5
0.15/run.sh Normal file
View File

@ -0,0 +1,5 @@
sudo docker run --rm -it \
-v /tmp/factorio:/factorio \
--name factorio \
factorio "$@"
find /tmp/factorio -type f