mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-04 16:08:15 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
324920cdf8 | |||
2c88f5e982 | |||
26cec3ae93 | |||
7897de5080 | |||
b474afc1b7 |
@ -7,3 +7,5 @@ services:
|
|||||||
- "27015:27015/tcp"
|
- "27015:27015/tcp"
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/factorio:/factorio
|
- /opt/factorio:/factorio
|
||||||
|
# user: 845:845
|
||||||
|
# user: 1000:1000
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
id
|
id
|
||||||
#
|
|
||||||
FACTORIO_VOL=/factorio
|
FACTORIO_VOL=/factorio
|
||||||
mkdir -p $FACTORIO_VOL
|
mkdir -p $FACTORIO_VOL
|
||||||
mkdir -p $SAVES
|
mkdir -p $SAVES
|
||||||
@ -12,15 +12,18 @@ mkdir -p $SCENARIOS
|
|||||||
mkdir -p $SCRIPTOUTPUT
|
mkdir -p $SCRIPTOUTPUT
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f $CONFIG/rconpw ]; then
|
||||||
|
# Generate a new RCON password if none exists
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f $CONFIG/server-settings.json ]; then
|
||||||
|
# Copy default settings if server-settings.json doesn't exist
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||||
# cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
# TODO: Need a valid map-gen-settings.json
|
||||||
|
# cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
||||||
echo "{}" > $CONFIG/map-gen-settings.json
|
echo "{}" > $CONFIG/map-gen-settings.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -29,10 +32,12 @@ if [ ! -f $CONFIG/map-settings.json ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
|
if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
|
||||||
|
# Delete incomplete saves (such as after a forced exit)
|
||||||
rm -f $SAVES/*.tmp.zip
|
rm -f $SAVES/*.tmp.zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||||
|
# Generate a new map if no save ZIPs exist
|
||||||
/opt/factorio/bin/x64/factorio \
|
/opt/factorio/bin/x64/factorio \
|
||||||
--create $SAVES/_autosave1.zip \
|
--create $SAVES/_autosave1.zip \
|
||||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
--map-gen-settings $CONFIG/map-gen-settings.json \
|
||||||
@ -40,10 +45,13 @@ if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" = '0' ]; then
|
if [ "$(id -u)" = '0' ]; then
|
||||||
|
# Take ownership of factorio data if running as root
|
||||||
chown -R factorio:factorio $FACTORIO_VOL
|
chown -R factorio:factorio $FACTORIO_VOL
|
||||||
|
# We want to drop to the factorio user
|
||||||
|
SU_EXEC="su-exec factorio"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec factorio /opt/factorio/bin/x64/factorio \
|
exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
||||||
--port $PORT \
|
--port $PORT \
|
||||||
--start-server-load-latest \
|
--start-server-load-latest \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings $CONFIG/server-settings.json \
|
||||||
@ -51,6 +59,8 @@ exec su-exec factorio /opt/factorio/bin/x64/factorio \
|
|||||||
--rcon-port $RCON_PORT \
|
--rcon-port $RCON_PORT \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist $CONFIG/server-whitelist.json \
|
||||||
--use-server-whitelist \
|
--use-server-whitelist \
|
||||||
|
--server-adminlist $CONFIG/server-adminlist.json \
|
||||||
|
--server-banlist $CONFIG/server-banlist.json \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat $CONFIG/rconpw)" \
|
||||||
--server-id /factorio/config/server-id.json \
|
--server-id /factorio/config/server-id.json \
|
||||||
$@
|
"$@"
|
||||||
|
28
README.md
28
README.md
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
*Tag descriptions*
|
*Tag descriptions*
|
||||||
|
|
||||||
* `latest` - the most up-to-date version (may be experimental).
|
* `latest` - most up-to-date version (may be experimental).
|
||||||
* `stable` - the version declared stable on [factorio.com](https://www.factorio.com).
|
* `stable` - version declared stable on [factorio.com](https://www.factorio.com).
|
||||||
* `0.x` - highest version in a branch: may be experimental.
|
* `0.x` - latest version in a branch.
|
||||||
* `0.x.y` - a specific version.
|
* `0.x.y` - a specific version.
|
||||||
* `0.x-dev` - whatever is in master for that version.
|
* `0.x-dev` - whatever is in master for that version.
|
||||||
|
|
||||||
@ -164,6 +164,24 @@ Create file `config/server-whitelist.json` and add the whitelisted users.
|
|||||||
"friend"
|
"friend"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
## Banlisting (0.17.1+)
|
||||||
|
|
||||||
|
Create file `config/server-banlist.json` and add the banlisted users.
|
||||||
|
|
||||||
|
[
|
||||||
|
"bad_person",
|
||||||
|
"other_bad_person"
|
||||||
|
]
|
||||||
|
|
||||||
|
## Adminlisting (0.17.1+)
|
||||||
|
|
||||||
|
Create file `config/server-adminlist.json` and add the adminlisted users.
|
||||||
|
|
||||||
|
[
|
||||||
|
"you",
|
||||||
|
"friend"
|
||||||
|
]
|
||||||
|
|
||||||
# Container Details
|
# Container Details
|
||||||
|
|
||||||
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||||
@ -182,7 +200,9 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
|||||||
| |-- map-gen-settings.json
|
| |-- map-gen-settings.json
|
||||||
| |-- rconpw
|
| |-- rconpw
|
||||||
| |-- server-settings.json
|
| |-- server-settings.json
|
||||||
| `-- server-whitelist.json
|
| |-- server-whitelist.json
|
||||||
|
| |-- server-banlist.json
|
||||||
|
| `-- server-adminlist.json
|
||||||
|-- mods
|
|-- mods
|
||||||
| `-- fancymod.zip
|
| `-- fancymod.zip
|
||||||
`-- saves
|
`-- saves
|
||||||
|
Reference in New Issue
Block a user