This commit is contained in:
madmaurice 2017-10-15 20:34:25 +02:00 committed by Hive
commit 1b6dca13e3
3 changed files with 26 additions and 11 deletions

View file

@ -1,18 +1,27 @@
FROM debian:jessie FROM debian:stretch
EXPOSE 34197/udp EXPOSE 34197/udp
ENV FACTORIO_VERSION 0.15.34
ADD bin/entrypoint.sh /entrypoint.sh
RUN \ RUN \
apt-get --yes update &&\ apt-get --yes update &&\
apt-get --yes install wget xz-utils &&\ apt-get --yes install wget xz-utils &&\
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &&\
adduser --disabled-password --gecos "" --home /opt/factorio factorio &&\
chmod 755 /entrypoint.sh &&\
mkdir -p /opt/factorio/headless /opt/factorio/saves &&\
chown -R factorio /opt/factorio
WORKDIR /root/ USER factorio
RUN \ RUN \
wget -O /tmp/headless.tgz https://www.factorio.com/get-download/0.15.34/headless/linux64 &&\ wget -O /tmp/headless.tgz https://www.factorio.com/get-download/$FACTORIO_VERSION/headless/linux64 &&\
tar xfv /tmp/headless.tgz && rm /tmp/headless.tgz tar xfv /tmp/headless.tgz -C /opt/factorio/headless && rm /tmp/headless.tgz
ADD bin/entrypoint.sh /entrypoint.sh ADD default-config.json /opt/factorio/headless/factorio/config/default.json
ADD default-config.json config/default.json
VOLUME /opt/factorio/saves
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["--server-settings", "config/config.json","--map-gen-settings","config/mapgen.json","--map-settings","config/map.json"] CMD ["--server-settings", "config/config.json","--map-gen-settings","config/mapgen.json","--map-settings","config/map.json"]

View file

@ -1,10 +1,16 @@
#!/bin/bash #!/bin/bash
set -e set -e
FACTORIO_BIN=/root/factorio/bin/x64/factorio BASE_DIR=/opt/factorio
WORLDNAME=/root/saves/world.zip
RUN_DIR=${BASE_DIR}/headless/factorio
FACTORIO_BIN=${RUN_DIR}/bin/x64/factorio
WORLDNAME=${BASE_DIR}/saves/world.zip
# Create savefile, if none exists # Create savefile, if none exists
[ ! -f ${WORLDNAME} ] && ${FACTORIO_BIN} --create ${WORLDNAME} "$@" [ ! -f ${WORLDNAME} ] && ${FACTORIO_BIN} --create ${WORLDNAME} "$@"
cd ${RUN_DIR}
exec ${FACTORIO_BIN} --start-server ${WORLDNAME} "$@" exec ${FACTORIO_BIN} --start-server ${WORLDNAME} "$@"

View file

@ -1,4 +1,4 @@
version: "3" version: "2"
services: services:
factorio: factorio:
@ -6,7 +6,7 @@ services:
ports: ports:
- 34197:34197/udp - 34197:34197/udp
volumes: volumes:
- world:/root/saves/ - world:/opt/factorio/saves/
volumes: volumes:
world: world: