mirror of
https://github.com/luzifer-docker/factorio.git
synced 2024-11-09 15:20:00 +00:00
Update image build, upgrade to 0.16.51
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9613d1fa38
commit
88c08ab5a9
3 changed files with 61 additions and 58 deletions
|
@ -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
|
|
||||||
|
|
41
Dockerfile
41
Dockerfile
|
@ -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
|
||||||
|
|
66
start.sh
66
start.sh
|
@ -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"
|
BINARY="/opt/factorio/bin/x64/factorio"
|
||||||
MAP_FILE="mapfile.zip"
|
MAP_FILE="mapfile.zip"
|
||||||
|
|
||||||
if ! [ -e /opt/factorio/config/config.ini ]; then
|
if ! [ -e /opt/factorio/config/config.ini ]; then
|
||||||
mkdir -p /opt/factorio/config
|
mkdir -p /opt/factorio/config
|
||||||
cp /opt/defaults/config.ini /opt/factorio/config/config.ini
|
cp /opt/defaults/config.ini /opt/factorio/config/config.ini
|
||||||
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
|
||||||
echo "Error: There is no map file at ${MAP_FILE}. Use 'create' or put a map file at that location."
|
echo "Error: There is no map file at ${MAP_FILE}. Use 'create' or put a map file at that location."
|
||||||
exit 1
|
exit 1
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue