mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 14:38:05 +02:00
Compare commits
53 Commits
Author | SHA1 | Date | |
---|---|---|---|
b41aad4dc6 | |||
24ac45dbce | |||
8286ab58ac | |||
c2d8509aa8 | |||
b94db83033 | |||
cc23bb396e | |||
1b2fdb298f | |||
ab277975ae | |||
80d8866242 | |||
4ec18b2d15 | |||
93a3011cd3 | |||
15cacdc3da | |||
927bcb89a0 | |||
4ceff25fc2 | |||
5d072db9cc | |||
216b225681 | |||
18f3943eaf | |||
2725534b2b | |||
df35d57455 | |||
9adc8ce4bc | |||
6272bb0018 | |||
a989b500b0 | |||
66bef56cd2 | |||
10f891cabf | |||
9a7f01f8bf | |||
877219f9c9 | |||
843bcbff21 | |||
a7786f03ed | |||
754663df49 | |||
9ac04bcff8 | |||
66d4652302 | |||
5ddb9ab472 | |||
9e72f0509a | |||
914b12adf4 | |||
dc3c040d7c | |||
6a9a596cd8 | |||
eb22dac840 | |||
b48bb4c134 | |||
cf5af1aae1 | |||
d7f0fe16d7 | |||
27c1426109 | |||
a86ac6cafe | |||
70e08f10f3 | |||
c28cea29a4 | |||
e21fc20eb2 | |||
c75b7fa830 | |||
387383d3e8 | |||
c6c94ee180 | |||
b2908081b4 | |||
e53c2adc54 | |||
14fb9ecf35 | |||
ffef5899e9 | |||
4449e13675 |
@ -9,8 +9,13 @@ ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.16.22 \
|
||||
SHA1=d6b6492bfc88052636ffdb51ac7aaa5f412d9b33
|
||||
VERSION=0.16.42 \
|
||||
SHA1=470ab5cbe036b5aedc51d577401ef37fbbdfeece \
|
||||
SAVES=/factorio/saves \
|
||||
CONFIG=/factorio/config \
|
||||
MODS=/factorio/mods \
|
||||
SCENARIOS=/factorio/scenarios \
|
||||
SCRIPTOUTPUT=/factorio/script-output
|
||||
|
||||
RUN mkdir -p /opt /factorio && \
|
||||
apk add --update --no-cache pwgen && \
|
||||
@ -21,18 +26,20 @@ RUN mkdir -p /opt /factorio && \
|
||||
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
||||
chmod ugo=rwx /opt/factorio && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods && \
|
||||
ln -s $SAVES /opt/factorio/saves && \
|
||||
ln -s $MODS /opt/factorio/mods && \
|
||||
ln -s $SCENARIOS /opt/factorio/scenarios && \
|
||||
ln -s $SCRIPTOUTPUT /opt/factorio/script-output && \
|
||||
apk del .build-deps && \
|
||||
addgroup -g $PGID -S $GROUP && \
|
||||
adduser -u $PUID -G $USER -s /bin/sh -SDH $GROUP && \
|
||||
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
|
||||
chown -R $USER:$GROUP /opt/factorio /factorio
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
COPY files/ /
|
||||
|
||||
USER $USER
|
||||
|
||||
|
@ -4,14 +4,11 @@ set -e
|
||||
|
||||
id
|
||||
|
||||
SAVES=/factorio/saves
|
||||
CONFIG=/factorio/config
|
||||
|
||||
mkdir -p $SAVES
|
||||
mkdir -p /factorio/mods
|
||||
mkdir -p $CONFIG
|
||||
|
||||
#chown -R factorio /factorio
|
||||
mkdir -p $MODS
|
||||
mkdir -p $SCENARIOS
|
||||
mkdir -p $SCRIPTOUTPUT
|
||||
|
||||
if [ ! -f $CONFIG/rconpw ]; then
|
||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||
@ -29,6 +26,10 @@ if [ ! -f $CONFIG/map-settings.json ]; then
|
||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
|
||||
rm -f $SAVES/*.tmp.zip
|
||||
fi
|
||||
|
||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/_autosave1.zip \
|
44
0.16/files/scenario.sh
Executable file
44
0.16/files/scenario.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/sh -x
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO=$1
|
||||
|
||||
set -e
|
||||
|
||||
id
|
||||
|
||||
mkdir -p $SAVES
|
||||
mkdir -p $CONFIG
|
||||
mkdir -p $MODS
|
||||
mkdir -p $SCENARIOS
|
||||
|
||||
#chown -R factorio /factorio
|
||||
|
||||
if [ ! -f $CONFIG/rconpw ]; then
|
||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port $PORT \
|
||||
--start-server-load-scenario $SCENARIO \
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--server-whitelist $CONFIG/server-whitelist.json \
|
||||
--server-banlist $CONFIG/server-banlist.json \
|
||||
--rcon-port $RCON_PORT \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
||||
--server-id /factorio/config/server-id.json
|
30
0.16/files/scenario2map.sh
Executable file
30
0.16/files/scenario2map.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh -x
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO=$1
|
||||
|
||||
set -e
|
||||
|
||||
id
|
||||
|
||||
mkdir -p $SAVES
|
||||
mkdir -p $CONFIG
|
||||
mkdir -p $MODS
|
||||
mkdir -p $SCENARIOS
|
||||
|
||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--scenario2map $SCENARIO
|
38
README.md
38
README.md
@ -1,7 +1,7 @@
|
||||
# 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.16.22`, `0.16`, `latest` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
||||
* `0.15.40`, `0.15`, `stable` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
||||
* `0.16.42`, `0.16`, `stable`, `latest` [(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.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
||||
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
|
||||
|
||||
@ -113,6 +113,38 @@ To generate a new map stop the server, delete all of the saves and restart the s
|
||||
Copy mods into the mods folder and restart the server.
|
||||
|
||||
|
||||
## Scenarios
|
||||
|
||||
If you want to launch a scenario from a clean start (not from a saved map) you'll need to start the docker image from an alternate entrypoint. To do this, use the example entrypoint file stored in the /factorio/entrypoints directory in the volume, and launch the image with the following syntax. Note that this is the normal syntax with the addition of the --entrypoint setting AND the additional argument at the end, which is the name of the Scenario in the Scenarios folder.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-p 34197:34197/udp \
|
||||
-p 27015:27015/tcp \
|
||||
-v /opt/factorio:/factorio \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
--entrypoint "/scenario.sh" \
|
||||
dtandersen/factorio \
|
||||
MyScenarioName
|
||||
```
|
||||
|
||||
## Converting Scenarios to Regular Maps
|
||||
|
||||
If you would like to export your scenario to a saved map, you can use the example entrypoint similar to the Scenario usag above. Factorio will run once, converting the Scenario to a saved Map in your saves directory. A restart of the docker image using the standard options will then load that map, just as if the scenario were just started by the Scenarios example noted above.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-p 34197:34197/udp \
|
||||
-p 27015:27015/tcp \
|
||||
-v /opt/factorio:/factorio \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
--entrypoint "/scenario2map.sh" \
|
||||
dtandersen/factorio
|
||||
MyScenarioName
|
||||
```
|
||||
|
||||
## RCON
|
||||
|
||||
Set the RCON password in the `rconpw` file. A random password is generated if `rconpw` doesn't exist.
|
||||
@ -256,7 +288,9 @@ Use the `PORT` environment variable to start the server on the a different port,
|
||||
# Contributors
|
||||
|
||||
* [dtandersen](https://github.com/dtandersen/docker_factorio_server) - Maintainer
|
||||
* [Fank](https://github.com/Fankserver/docker-factorio-watchdog) - Keeper of the Factorio watchdog that keeps the version up-to-date.
|
||||
* [Zopanix](https://github.com/zopanix/docker_factorio_server) - Originator
|
||||
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Randomly generate RCON password
|
||||
* [gnomus](https://github.com/gnomus/docker_factorio_server) - White listing
|
||||
* [bplein](https://github.com/bplein/docker_factorio_server) - Scenario support
|
||||
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Version update
|
||||
|
Reference in New Issue
Block a user