Update image build, upgrade to 0.16.51

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-06-19 13:14:45 +02:00
parent 9613d1fa38
commit 88c08ab5a9
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 61 additions and 58 deletions

View file

@ -1,12 +0,0 @@
---
image: "quay.io/luzifer/repo-runner-image"
checkout_dir: /src/factorio
commands:
- make ci
environment:
GHUSER: luzifer-docker
GPG_KEY: 316D1333

View file

@ -1,22 +1,35 @@
FROM debian FROM debian:stretch
ENV FACTORIO_SERVER_VERSION 0.15.37 ENV FACTORIO_SERVER_VERSION=0.16.51 \
DUMB_INIT_VERSION=1.2.1 \
GOSU_VERSION=1.10
RUN set -ex \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
xz-utils \
&& curl -sSfLo /usr/local/bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64" \
&& curl -sSfLo /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
&& chmod +x \
/usr/local/bin/dumb-init \
/usr/local/bin/gosu \
&& mkdir -p /opt \
&& curl -sSLf "https://www.factorio.com/get-download/${FACTORIO_SERVER_VERSION}/headless/linux64" | \
tar -C /opt -x -J \
&& useradd -d /opt/factorio -M -u 10000 factorio \
&& apt-get purge -y \
ca-certificates \
curl \
xz-utils \
&& apt-get autoremove -y --purge \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/opt/defaults/start.sh"] ENTRYPOINT ["/opt/defaults/start.sh"]
EXPOSE 34197/udp EXPOSE 34197/udp
ADD . /opt/defaults COPY . /opt/defaults
RUN set -ex \
&& apt-get update && apt-get install -y curl xz-utils \
&& mkdir -p /opt \
&& useradd -d /opt/factorio -M -u 10000 factorio \
&& curl -sSLfo /tmp/factorio.tgz https://www.factorio.com/get-download/${FACTORIO_SERVER_VERSION}/headless/linux64 \
&& tar -C /opt -x -J -f /tmp/factorio.tgz \
&& chown -R factorio:factorio /opt/factorio \
&& rm /tmp/factorio.tgz
USER factorio
VOLUME /data VOLUME /data
WORKDIR /data WORKDIR /data

View file

@ -1,8 +1,10 @@
#!/bin/bash -e #!/usr/local/bin/dumb-init /bin/bash
set -euo pipefail
set -o pipefail # Ensure factorio owns /data
chown -R factorio:factorio /data
ACTION=$1 ACTION=${1:-help}
BINARY="/opt/factorio/bin/x64/factorio" BINARY="/opt/factorio/bin/x64/factorio"
MAP_FILE="mapfile.zip" MAP_FILE="mapfile.zip"
@ -12,17 +14,17 @@ if ! [ -e /opt/factorio/config/config.ini ]; then
fi fi
case ${ACTION} in case ${ACTION} in
"init") "init")
echo "Initializing files in case they do not exist: map-gen-settings.json / server-settings.json" echo "Initializing files in case they do not exist: map-gen-settings.json / server-settings.json"
[ -e map-gen-settings.json ] || cp /opt/defaults/map-gen-settings.json map-gen-settings.json [ -e map-gen-settings.json ] || cp /opt/defaults/map-gen-settings.json map-gen-settings.json
[ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json [ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
;; ;;
"create") "create")
echo "Creating map at ${MAP_FILE} with settings from map-gen-settings.json" echo "Creating map at ${MAP_FILE} with settings from map-gen-settings.json"
[ -e map-gen-settings.json ] || cp /opt/defaults/map-gen-settings.json map-gen-settings.json [ -e map-gen-settings.json ] || cp /opt/defaults/map-gen-settings.json map-gen-settings.json
exec ${BINARY} --map-gen-settings map-gen-settings.json --create ${MAP_FILE} exec gosu factorio ${BINARY} --map-gen-settings map-gen-settings.json --create ${MAP_FILE}
;; ;;
"start") "start")
echo "Starting game from map file ${MAP_FILE} with settings from server-settings.json" echo "Starting game from map file ${MAP_FILE} with settings from server-settings.json"
if ! [ -e ${MAP_FILE} ]; then if ! [ -e ${MAP_FILE} ]; then
@ -31,14 +33,14 @@ case ${ACTION} in
fi fi
[ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json [ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
exec ${BINARY} --server-settings server-settings.json --start-server ${MAP_FILE} exec gosu factorio ${BINARY} --server-settings server-settings.json --start-server ${MAP_FILE}
;; ;;
"help") "help")
echo "Usage: docker run quay.io/luzifer/factorio [init | create | start]" echo "Usage: docker run luzifer/factorio [init | create | start]"
echo echo
echo "Alternative: docker run quay.io/luzifer/factorio <factorio server options>" echo "Alternative: docker run luzifer/factorio <factorio server options>"
;; ;;
*) *)
exec ${BINARY} "$@" exec gosu factorio ${BINARY} "$@"
;; ;;
esac esac