Compare commits

...

5 Commits

Author SHA1 Message Date
Robbie Penziol
c1b0f6ca83 Add versioned "stable" tag. i.e. "stable-<major>.<minor>.<patch>" (#490) 2024-06-12 20:12:58 +09:00
Florian Kinder
965fef7ac2 Removed versions 2024-06-12 20:12:27 +09:00
heinGertenbach
88fed07073 container label for factorio version (#493) 2024-06-12 19:48:50 +09:00
Tristin Stagg
4ab4c889f4 Add support for --preset options provided by vanilla and popular mods (#482)
* Add support for --preset options provided by vanilla and popular mods

* Add support for --preset in scenario.sh

* Replace SU_EXEC with EXEC
2024-06-12 19:47:42 +09:00
Florian Kinder
bc28f4a917 Added missing envsubst command
Fixes #489
2024-06-12 19:46:53 +09:00
6 changed files with 30 additions and 49 deletions

View File

@@ -57,48 +57,6 @@
"1.1.107"
]
},
"1.1.98": {
"sha256": "692ff293105151f436f59ef9c9a339e667da3caf9a90794719207a1dde180a99",
"tags": [
"1.1.98"
]
},
"1.1.99": {
"sha256": "4107a13a9bff87f001b1b4650367a8c6ba5c2d67b787d52cf2db3f3923850935",
"tags": [
"1.1.99"
]
},
"1.1.102": {
"sha256": "f68cbf9ec32f750d37675f998467eadfc3d580d8ec7b14e64b1e9ef1a895a7e1",
"tags": [
"1.1.102"
]
},
"1.1.103": {
"sha256": "53dc6040181402e78a435eeb01c6cde1a4fe8aa676eb4c051433af3e6b4f92fa",
"tags": [
"1.1.103"
]
},
"1.1.105": {
"sha256": "dc72d69e7027052da38376a61e811138814df584af0e814a41f20db07655e39e",
"tags": [
"1.1.105"
]
},
"1.1.106": {
"sha256": "6787394965d1eaaf9b7638eecda6de3e3d5d96f0d89fe28c93bd610558fbbb04",
"tags": [
"1.1.106"
]
},
"1.1.108": {
"sha256": "c0f7aa839e840c88aa66c9657cb06918c9b797693b7ea84c4e2f0e46d0117fa6",
"tags": [
"1.1.108"
]
},
"1.1.109": {
"sha256": "105a38533c916fe66e2fb2b9fe8f93c116568047a20c4daa74632072c077bf3f",
"tags": [

13
docker/Dockerfile Normal file → Executable file
View File

@@ -8,10 +8,20 @@ ARG PUID=845
ARG PGID=845
ARG BOX64_VERSION=v0.2.4
# optionally utilize a built-in map-gen-preset (see data/base/prototypes/map-gen-presets
# if this is used, the preset will be used over any .json files supplied
# vanilla factorio provides the following presets:
# rich-resources, marathon, death-world, death-world-marathon, rail-world, ribbon-world, island
# a modded factorio example for using this:
# space-exploration
ARG PRESET
# version checksum of the archive to download
ARG VERSION
ARG SHA256
LABEL factorio.version=${VERSION}
# number of retries that curl will use when pulling the headless server tarball
ARG CURL_RETRIES=8
@@ -20,6 +30,7 @@ ENV PORT=34197 \
VERSION=${VERSION} \
SHA256=${SHA256} \
SAVES=/factorio/saves \
PRESET="$PRESET" \
CONFIG=/factorio/config \
MODS=/factorio/mods \
SCENARIOS=/factorio/scenarios \
@@ -40,7 +51,7 @@ RUN set -ox pipefail \
&& archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
&& mkdir -p /opt /factorio \
&& apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils procps --no-install-recommends \
&& DEBIAN_FRONTEND=noninteractive apt-get -qy install ca-certificates curl jq pwgen xz-utils procps gettext-base --no-install-recommends \
&& curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" --retry $CURL_RETRIES\
&& echo "$SHA256 $archive" | sha256sum -c \
|| (sha256sum "$archive" && file "$archive" && exit 1) \

View File

@@ -20,4 +20,5 @@ services:
# - USERNAME=FactorioUsername
# - TOKEN=FactorioToken
# - PORT=34198
# - PRESET=deathworld
# - ADDR=::1

View File

@@ -1,9 +1,9 @@
#!/bin/bash
set -eoux pipefail
FACTORIO_VOL=/factorio
LOAD_LATEST_SAVE="${LOAD_LATEST_SAVE:-true}"
GENERATE_NEW_SAVE="${GENERATE_NEW_SAVE:-false}"
PRESET="${PRESET:-""}"
SAVE_NAME="${SAVE_NAME:-""}"
BIND="${BIND:-""}"
CONSOLE_LOG_LOCATION="${CONSOLE_LOG_LOCATION:-""}"
@@ -75,10 +75,18 @@ if [[ $GENERATE_NEW_SAVE == true ]]; then
if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then
echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation"
else
$EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/$SAVE_NAME.zip" \
--map-gen-settings "$CONFIG/map-gen-settings.json" \
--map-settings "$CONFIG/map-settings.json"
if [[ ! -z "$PRESET" ]]; then
$EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/$SAVE_NAME.zip" \
--preset "$PRESET" \
--map-gen-settings "$CONFIG/map-gen-settings.json" \
--map-settings "$CONFIG/map-settings.json"
else
$EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/$SAVE_NAME.zip" \
--map-gen-settings "$CONFIG/map-gen-settings.json" \
--map-settings "$CONFIG/map-settings.json"
fi
fi
fi

View File

@@ -6,6 +6,8 @@ if [[ -z ${1:-} ]]; then
fi
SERVER_SCENARIO="$1"
PRESET="${PRESET:-""}"
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
@@ -32,6 +34,7 @@ fi
exec /opt/factorio/bin/x64/factorio \
--port "$PORT" \
--start-server-load-scenario "$SERVER_SCENARIO" \
--preset "$PRESET" \
--map-gen-settings "$CONFIG/map-gen-settings.json" \
--map-settings "$CONFIG/map-settings.json" \
--server-settings "$CONFIG/server-settings.json" \

View File

@@ -67,7 +67,7 @@ cp buildinfo.json "$tmpfile"
if [[ $stableOnlineVersionShort == "$stableCurrentVersionShort" ]]; then
jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" 'with_entries(if .key == $stable_current_version then .key |= $stable_online_version | .value.sha256 |= $sha256 | .value.tags |= . - [$stable_current_version] + [$stable_online_version] else . end)' "$tmpfile" > buildinfo.json
else
jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["latest","stable",$stableOnlineVersionMajor] else . end) | to_entries | . + [{ key: $stable_online_version, value: { sha256: $sha256, tags: ["latest","stable",$stableOnlineVersionMajor,$stableOnlineVersionShort,$stable_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json
jq --arg stable_current_version "$stable_current_version" --arg stable_online_version "$stable_online_version" --arg sha256 "$stable_sha256" --arg stableOnlineVersionShort "$stableOnlineVersionShort" --arg stableOnlineVersionMajor "$stableOnlineVersionMajor" 'with_entries(if .key == $stable_current_version then .value.tags |= . - ["latest","stable",$stableOnlineVersionMajor] else . end) | to_entries | . + [{ key: $stable_online_version, value: { sha256: $sha256, tags: ["latest","stable",("stable-" + $stable_online_version),$stableOnlineVersionMajor,$stableOnlineVersionShort,$stable_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json
fi
rm -f -- "$tmpfile"