Update container to stretch and use factorio user instead of root
This commit is contained in:
parent
78b99a6ba3
commit
16a4872ea3
3 changed files with 25 additions and 10 deletions
23
Dockerfile
23
Dockerfile
|
@ -1,18 +1,27 @@
|
||||||
FROM debian:jessie
|
FROM debian:stretch
|
||||||
EXPOSE 34197/udp
|
EXPOSE 34197/udp
|
||||||
|
|
||||||
|
ENV FACTORIO_VERSION 0.15.33
|
||||||
|
|
||||||
|
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.5/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/default.json"]
|
CMD ["--server-settings", "config/default.json"]
|
||||||
|
|
|
@ -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} "$@"
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue