Compare commits

..

43 Commits

Author SHA1 Message Date
7884f7f4f5 🎨
Took 3 minutes
2024-11-02 14:34:56 +01:00
a169eb92d9 Added extra_host example for NAS
Took 11 minutes
2024-11-02 14:27:49 +01:00
8c9dfd004e Use stable_online_version instead of stableOnlineVersionShort
This hopefully causes the stable tag to not be removed anymore for an unknown reason.
2024-11-01 17:50:52 +01:00
867635db16 Auto Update Factorio to stable version: 2.0.13 experimental version: 2.0.14 2024-11-01 15:23:21 +00:00
b7413607c4 Auto Update Factorio to stable version: 2.0.13 experimental version: 2.0.14 2024-11-01 14:20:23 +00:00
5d6f70b285 Auto Update Factorio to stable version: 2.0.13 experimental version: 2.0.13 2024-10-31 15:23:56 +00:00
a24e42b281 Auto Update Factorio to stable version: 2.0.13 experimental version: 2.0.13 2024-10-31 14:20:50 +00:00
d1142e3408 Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.13 2024-10-31 13:28:03 +00:00
4eb53b6e48 Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.12 2024-10-31 12:43:16 +00:00
f986f1c870 Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.13 2024-10-30 20:23:47 +00:00
bc760a9599 Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.13 2024-10-30 19:18:52 +00:00
d153e30f1c Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.12 2024-10-29 13:29:24 +00:00
cc5061d339 Auto Update Factorio to stable version: 2.0.12 experimental version: 2.0.12 2024-10-29 12:44:42 +00:00
14ae422463 Auto Update Factorio to stable version: 2.0.11 experimental version: 2.0.12 2024-10-28 18:30:19 +00:00
88ca95a1ae Auto Update Factorio to stable version: 2.0.11 experimental version: 2.0.12 2024-10-28 17:20:48 +00:00
64980b9db3 using absolute path over relative path for subscripts (#538) 2024-10-27 19:49:15 +01:00
85f8011105 Update README_zh_CN.md (#535)
fix spelling typo
2024-10-26 16:33:42 +02:00
cc8d89df84 Auto Update Factorio to stable version: 2.0.11 experimental version: 2.0.11 2024-10-26 09:20:52 +00:00
956ade4f0b Auto Update Factorio to stable version: 2.0.11 experimental version: 2.0.11 2024-10-26 08:25:28 +00:00
049d34ea9a Auto Update Factorio to stable version: 2.0.10 experimental version: 2.0.11 2024-10-25 16:27:26 +00:00
d01580b5a5 Auto Update Factorio to stable version: 2.0.10 experimental version: 2.0.11 2024-10-25 15:22:54 +00:00
25a283ad79 Readded REPO_TOKEN in checkout, because workflows are not triggered.
related #526
2024-10-24 16:17:01 +02:00
b172b16ff4 Auto Update Factorio to stable version: 2.0.10 experimental version: 2.0.10 2024-10-24 14:01:05 +00:00
eb150cff0d Auto Update Factorio to stable version: 2.0.10 experimental version: 2.0.10 2024-10-24 13:59:37 +00:00
b20d93e229 Change DLC_SPACE_AGE to enable specific Space Age mods (#530)
* Change variable DLC_SPACE_AGE to allow listing specific Space Age mods to enable

* Adjust DLC_SPACE_AGE note

Co-authored-by: Florian Kinder <florian.kinder@fankserver.com>

---------

Co-authored-by: Florian Kinder <florian.kinder@fankserver.com>
2024-10-23 23:54:02 +02:00
9562212254 Filter for path and remove tags
related #526
2024-10-23 23:53:11 +02:00
6060c7b722 Auto Update Factorio to stable version: 2.0.9 experimental version: 2.0.10 2024-10-23 21:20:20 +00:00
06baf6a186 Auto Update Factorio to stable version: 2.0.9 experimental version: 2.0.10 2024-10-23 20:24:52 +00:00
6eb0cd96d8 MODS is available since 2.0.8
Took 11 minutes
2024-10-23 17:24:05 +02:00
bbbfef343c Auto Update Factorio to stable version: 2.0.9 experimental version: 2.0.9 2024-10-23 11:18:00 +00:00
44a58b056c Auto Update Factorio to stable version: 2.0.9 experimental version: 2.0.9 2024-10-23 10:23:09 +00:00
e37bcf1ed0 Create base mod-list.json if it does not exist (#523) 2024-10-22 23:54:00 +02:00
3defd74c46 Merge branch 'hjhixon-patch-1' 2024-10-22 23:41:12 +02:00
dde2761a8c fix entrypoint logic for checking if root 2024-10-22 23:40:47 +02:00
0ec91c3391 Add documentation for env variable MODS and make it actually change the mod directory (#520) 2024-10-22 23:22:20 +02:00
f9040c7450 Added missing environment variable
Took 20 minutes
2024-10-22 21:23:58 +02:00
c9957b7d76 Auto Update Factorio to stable version: 2.0.8 experimental version: 2.0.9 2024-10-22 19:19:24 +00:00
89ae20012e Added DLC_SPACE_AGE environment variable (#519)
* Added DLC_SPACE_AGE environment variable to enable or disable dlc related mods

Took 53 minutes

* 🎨

Took 2 minutes
2024-10-22 20:40:34 +02:00
d137f32c2f Auto Update Factorio to stable version: 2.0.8 experimental version: 2.0.9 2024-10-22 18:29:48 +00:00
4f3c5f2e93 Do not run the build in pull requests
Took 6 minutes
2024-10-22 19:33:29 +02:00
f7e9dea263 Improve logging in updating mods (#518)
Took 55 minutes
2024-10-22 19:28:25 +02:00
748dec4ad5 Fixed tag match in update (#515)
Took 38 minutes
2024-10-22 07:40:13 +02:00
3ce89a714b Auto Update Factorio to stable version: 2.0.8 experimental version: 2.0.8 2024-10-22 05:21:25 +00:00
12 changed files with 119 additions and 32 deletions

View File

@ -4,9 +4,10 @@ on:
push:
branches:
- master
tags:
- latest
pull_request:
paths:
- buildinfo.json
# workaround for #526
workflow_dispatch:
jobs:
build:

View File

@ -4,6 +4,10 @@ on:
push:
branches:
- master
paths:
- README.md
# workaround for #526
workflow_dispatch:
jobs:
docker-description:

View File

@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_TOKEN }}
- name: Run update script
run: ./update.sh

View File

@ -6,8 +6,8 @@
[中文](./README_zh_CN.md)
<!-- start autogeneration tags -->
* `2`, `2.0`, `2.0.8`, `latest`, `stable`, `stable-2.0.8`
* `2`, `2.0`, `2.0.7`, `stable`, `stable-2.0.7`
* `2.0.14`, `latest`
* `2`, `2.0`, `2.0.13`, `stable`, `stable-2.0.13`
* `1`, `1.1`, `1.1.110`, `stable-1.1.110`
* `1.0`, `1.0.0`
* `0.17`, `0.17.79`
@ -262,7 +262,7 @@ The `server-settings.json` file may then contain the variable references like th
These are the environment variables which can be specified at container run time.
| Variable Name | Description | Default | Available in |
| - | - | - | - |
|----------------------|----------------------------------------------------------------------|----------------|--------------|
| GENERATE_NEW_SAVE | Generate a new save if one does not exist before starting the server | false | 0.17+ |
| LOAD_LATEST_SAVE | Load latest when true. Otherwise load SAVE_NAME | true | 0.17+ |
| PORT | UDP port the server listens on | 34197 | 0.15+ |
@ -271,8 +271,10 @@ These are the environment variables which can be specified at container run time
| SAVE_NAME | Name to use for the save file | _autosave1 | 0.17+ |
| TOKEN | factorio.com token | | 0.17+ |
| UPDATE_MODS_ON_START | If mods should be updated before starting the server | | 0.17+ |
| USERNAME | factorio.com username | | 0.17+ | |
| CONSOLE_LOG_LOCATION | Saves the console log to the specifies location | |
| USERNAME | factorio.com username | | 0.17+ |
| CONSOLE_LOG_LOCATION | Saves the console log to the specifies location | | |
| DLC_SPACE_AGE | Enables or disables the mods for DLC Space Age in mod-list.json[^1] | true | 2.0.8+ |
| MODS | Mod directory to use | /factorio/mods | 2.0.8+ |
**Note:** All environment variables are compared as strings
@ -430,3 +432,8 @@ Use the `PORT` environment variable to start the server on the a different port,
* [bplein](https://github.com/bplein/docker_factorio_server) - Coded scenario support
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Contributed version updates
* [carlbennett](https://github.com/carlbennett) - Contributed version updates and bugfixes
[^1]: Space Age mods can also be individually enabled by using their name separated by space.
Example 1: Enable all by using `true`
Example 2: Enable all by listing the mod names `space-age elevated-rails quality`
Example 3: Enable only Elevated rails `elevated-rails`

View File

@ -10,7 +10,7 @@
* `0.x.y` - 具体的版本
* `0.x-z` - 在该版本上的增量更新
## 什么是 Facotrio
## 什么是 Factorio
> 摘录自 [steam factorio 页面](https://store.steampowered.com/app/427520/Factorio/)

View File

@ -57,15 +57,21 @@
"1.1.110"
]
},
"2.0.8": {
"sha256": "d9594c4d552a3e4f965b188a4774da8c8b010fc23ddb0efc63b1d94818dde1ca",
"2.0.13": {
"sha256": "27b36901a39e593adf28418c0286142c6c7a9f83d156963c7369bd405a25c7d1",
"tags": [
"latest",
"stable",
"stable-2.0.8",
"stable-2.0.13",
"2",
"2.0",
"2.0.8"
"2.0.13"
]
},
"2.0.14": {
"sha256": "5a4bc4c3b2a97ed1fc58eb796321e848dcc64435bd91013dd9c78a14a8ce8815",
"tags": [
"latest",
"2.0.14"
]
}
}

View File

@ -28,7 +28,8 @@ ENV PORT=34197 \
SCENARIOS=/factorio/scenarios \
SCRIPTOUTPUT=/factorio/script-output \
PUID="$PUID" \
PGID="$PGID"
PGID="$PGID" \
DLC_SPACE_AGE="true"
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]

View File

@ -6,8 +6,8 @@ services:
args:
# Check buildinfo.json for supported versions and SHAs
# https://github.com/factoriotools/factorio-docker/blob/master/buildinfo.json
- VERSION=2.0.8
- SHA256=d9594c4d552a3e4f965b188a4774da8c8b010fc23ddb0efc63b1d94818dde1ca
- VERSION=2.0.13
- SHA256=27b36901a39e593adf28418c0286142c6c7a9f83d156963c7369bd405a25c7d1
ports:
- "34197:34197/udp"
- "27015:27015/tcp"
@ -22,3 +22,8 @@ services:
# - PORT=34198
# - PRESET=deathworld
# - ADDR=::1
# # Uncomment the following line to enable the use of the host's network stack,
# # which may be necessary for some setups like NAS or when using some proxy service like firewall rules.
# extra_hosts:
# - "host.docker.internal:host-gateway"

57
docker/files/docker-dlc.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
set -eou pipefail
# Path to the mod-list.json file
MOD_LIST_FILE="$MODS/mod-list.json"
ALL_SPACE_AGE_MODS=("elevated-rails" "quality" "space-age")
if [[ ! -f "$MOD_LIST_FILE" ]]; then
# Create the mod-list.json file if it doesn't exist
echo '{"mods":[{"name":"base","enabled":true}]}' > "$MOD_LIST_FILE"
fi
enable_mod()
{
echo "Enable mod $1 for DLC"
jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == false then .enabled = true else . end) else . end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp"
mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE"
}
disable_mod()
{
echo "Disable mod $1 for DLC"
jq --arg mod_name "$1" 'if .mods | map(.name) | index($mod_name) then .mods |= map(if .name == $mod_name and .enabled == true then .enabled = false else . end) else .mods += [{"name": $mod_name, "enabled": false}] end' "$MOD_LIST_FILE" > "$MOD_LIST_FILE.tmp"
mv "$MOD_LIST_FILE.tmp" "$MOD_LIST_FILE"
}
# Enable or disable DLCs if configured
if [[ ${DLC_SPACE_AGE:-} == "true" ]]; then
# Define the DLC mods
ENABLE_MODS=(${ALL_SPACE_AGE_MODS[@]})
elif [[ ${DLC_SPACE_AGE:-} == "false" ]]; then
# Define the DLC mods
DISABLE_MODS=(${ALL_SPACE_AGE_MODS[@]})
else
ENABLE_MODS=()
DISABLE_MODS=()
for SPACE_AGE_MOD in "${ALL_SPACE_AGE_MODS[@]}"; do
REGEX="(^|\s)$SPACE_AGE_MOD($|\s)"
if [[ "$DLC_SPACE_AGE" =~ $REGEX ]]; then
ENABLE_MODS+=($SPACE_AGE_MOD)
else
DISABLE_MODS+=($SPACE_AGE_MOD)
fi
done
fi
# Iterate over each DLC mod to enable
for MOD in "${ENABLE_MODS[@]}"; do
enable_mod "$MOD"
done
# Iterate over each DLC mod to disable
for MOD in "${DISABLE_MODS[@]}"; do
disable_mod "$MOD"
done

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -eoux pipefail
INSTALLED_DIRECTORY=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
FACTORIO_VOL=/factorio
LOAD_LATEST_SAVE="${LOAD_LATEST_SAVE:-true}"
GENERATE_NEW_SAVE="${GENERATE_NEW_SAVE:-false}"
@ -40,11 +41,13 @@ if [[ $NRTMPSAVES -gt 0 ]]; then
fi
if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
./docker-update-mods.sh
${INSTALLED_DIRECTORY}/docker-update-mods.sh
fi
${INSTALLED_DIRECTORY}/docker-dlc.sh
EXEC=""
if [[ $(id -u) = 0 ]]; then
if [[ $(id -u) == 0 ]]; then
# Update the User and Group ID based on the PUID/PGID variables
usermod -o -u "$PUID" factorio
groupmod -o -g "$PGID" factorio
@ -100,6 +103,7 @@ FLAGS=(\
--server-adminlist "$CONFIG/server-adminlist.json" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--server-id /factorio/config/server-id.json \
--mod-directory "$MODS" \
)
if [ -n "$CONSOLE_LOG_LOCATION" ]; then

View File

@ -28,7 +28,7 @@ update_mod()
MOD_NAME="$1"
MOD_NAME_ENCODED="${1// /%20}"
print_step "Checking for update of mod $MOD_NAME..."
print_step "Checking for update of mod $MOD_NAME for factorio $FACTORIO_VERSION ..."
MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME_ENCODED"
MOD_INFO_JSON=$(curl --silent "$MOD_INFO_URL")
@ -54,7 +54,7 @@ update_mod()
return 0
fi
print_step "Downloading..."
print_step " Downloading $MOD_FILENAME"
FULL_URL="$MOD_BASE_URL$MOD_URL?username=$USERNAME&token=$TOKEN"
HTTP_STATUS=$(curl --silent -L -w "%{http_code}" -o "$MOD_DIR/$MOD_FILENAME" "$FULL_URL")

View File

@ -73,8 +73,8 @@ rm -f -- "$tmpfile"
# Update tag by stable
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
if [[ "$stable_online_version" == "$stable_current_version" ]]; 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, "stable"] 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",("stable-" + $stable_online_version),$stableOnlineVersionMajor,$stableOnlineVersionShort,$stable_online_version]}}] | from_entries' "$tmpfile" > buildinfo.json
fi