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"]
EXPOSE 34197/udp
ADD . /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
COPY . /opt/defaults
VOLUME /data
WORKDIR /data

View file

@ -1,44 +1,46 @@
#!/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"
MAP_FILE="mapfile.zip"
if ! [ -e /opt/factorio/config/config.ini ]; then
mkdir -p /opt/factorio/config
cp /opt/defaults/config.ini /opt/factorio/config/config.ini
mkdir -p /opt/factorio/config
cp /opt/defaults/config.ini /opt/factorio/config/config.ini
fi
case ${ACTION} in
"init")
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 server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
;;
"create")
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
exec ${BINARY} --map-gen-settings map-gen-settings.json --create ${MAP_FILE}
;;
"start")
echo "Starting game from map file ${MAP_FILE} with settings from server-settings.json"
"init")
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 server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
;;
"create")
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
exec gosu factorio ${BINARY} --map-gen-settings map-gen-settings.json --create ${MAP_FILE}
;;
"start")
echo "Starting game from map file ${MAP_FILE} with settings from server-settings.json"
if ! [ -e ${MAP_FILE} ]; then
echo "Error: There is no map file at ${MAP_FILE}. Use 'create' or put a map file at that location."
exit 1
fi
if ! [ -e ${MAP_FILE} ]; then
echo "Error: There is no map file at ${MAP_FILE}. Use 'create' or put a map file at that location."
exit 1
fi
[ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
exec ${BINARY} --server-settings server-settings.json --start-server ${MAP_FILE}
;;
"help")
echo "Usage: docker run quay.io/luzifer/factorio [init | create | start]"
echo
echo "Alternative: docker run quay.io/luzifer/factorio <factorio server options>"
;;
*)
exec ${BINARY} "$@"
;;
[ -e server-settings.json ] || cp /opt/defaults/server-settings.json server-settings.json
exec gosu factorio ${BINARY} --server-settings server-settings.json --start-server ${MAP_FILE}
;;
"help")
echo "Usage: docker run luzifer/factorio [init | create | start]"
echo
echo "Alternative: docker run luzifer/factorio <factorio server options>"
;;
*)
exec gosu factorio ${BINARY} "$@"
;;
esac