mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-03 07:28:27 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
8e7bca222a | |||
3e7c79ab74 | |||
979326ebf6 | |||
d5ac333364 | |||
e941e9a2c8 | |||
6fece0c9e3 | |||
10d000408c | |||
d59fd0844a | |||
324920cdf8 |
@ -9,8 +9,8 @@ ARG PGID=845
|
|||||||
|
|
||||||
ENV PORT=34197 \
|
ENV PORT=34197 \
|
||||||
RCON_PORT=27015 \
|
RCON_PORT=27015 \
|
||||||
VERSION=0.17.1 \
|
VERSION=0.17.2 \
|
||||||
SHA1=cab0b48a5ddb1870bab2c07cc6ad5726097c1fc5 \
|
SHA1=0f0931e3444befcd5e37abe912551f75f681c4ca \
|
||||||
SAVES=/factorio/saves \
|
SAVES=/factorio/saves \
|
||||||
CONFIG=/factorio/config \
|
CONFIG=/factorio/config \
|
||||||
MODS=/factorio/mods \
|
MODS=/factorio/mods \
|
||||||
@ -34,6 +34,10 @@ RUN mkdir -p /opt /factorio && \
|
|||||||
addgroup -g $PGID -S $GROUP && \
|
addgroup -g $PGID -S $GROUP && \
|
||||||
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
|
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
|
||||||
chown -R $USER:$GROUP /opt/factorio /factorio
|
chown -R $USER:$GROUP /opt/factorio /factorio
|
||||||
|
# mkdir -p /opt/factorio/temp && \
|
||||||
|
# chmod 777 -R /opt/factorio/temp && \
|
||||||
|
# mkdir -p /opt/factorio/temp && \
|
||||||
|
# chmod 777 -R /opt/factorio/temp && \
|
||||||
|
|
||||||
VOLUME /factorio
|
VOLUME /factorio
|
||||||
|
|
||||||
|
@ -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,17 @@ 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
|
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,21 +31,29 @@ 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 [ "$(id -u)" = '0' ]; then
|
||||||
|
# Take ownership of factorio data if running as root
|
||||||
|
chown -R factorio:factorio $FACTORIO_VOL
|
||||||
|
# Make sure we own temp
|
||||||
|
#mkdir -p /opt/factorio/temp
|
||||||
|
#chown -R factorio:factorio /opt/factorio/temp
|
||||||
|
# Drop to the factorio user
|
||||||
|
SU_EXEC="su-exec factorio"
|
||||||
|
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
|
||||||
/opt/factorio/bin/x64/factorio \
|
# Generate a new map if no save ZIPs exist
|
||||||
|
${SU_EXEC} /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 \
|
||||||
--map-settings $CONFIG/map-settings.json
|
--map-settings $CONFIG/map-settings.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" = '0' ]; then
|
exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
||||||
chown -R factorio:factorio $FACTORIO_VOL
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec su-exec factorio /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 \
|
||||||
@ -55,4 +65,4 @@ exec su-exec factorio /opt/factorio/bin/x64/factorio \
|
|||||||
--server-banlist $CONFIG/server-banlist.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 \
|
||||||
$@
|
"$@"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Factorio [](https://microbadger.com/images/dtandersen/factorio "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
# Factorio [](https://microbadger.com/images/dtandersen/factorio "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
||||||
|
|
||||||
* `0.17.1`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
|
* `0.17.2-1`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
|
||||||
* `0.16.51`, `0.16`, `stable` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
* `0.16.51`, `0.16`, `stable` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
||||||
* `0.15.40`, `0.15` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
* `0.15.40`, `0.15` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
||||||
* `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
* `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
||||||
|
Reference in New Issue
Block a user