mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 14:38:05 +02:00
Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
e53c2adc54 | |||
14fb9ecf35 | |||
ffef5899e9 | |||
4449e13675 |
@ -9,8 +9,12 @@ ARG PGID=845
|
|||||||
|
|
||||||
ENV PORT=34197 \
|
ENV PORT=34197 \
|
||||||
RCON_PORT=27015 \
|
RCON_PORT=27015 \
|
||||||
VERSION=0.16.23 \
|
VERSION=0.16.32 \
|
||||||
SHA1=edb8e75f606180ee1d829072af14a946cff26a4b
|
SHA1=735f8d8a37cddc1fa4ca0e856cfe9b536eee1d2f \
|
||||||
|
SAVES=/factorio/saves \
|
||||||
|
CONFIG=/factorio/config \
|
||||||
|
MODS=/factorio/mods \
|
||||||
|
SCENARIOS=/factorio/scenarios
|
||||||
|
|
||||||
RUN mkdir -p /opt /factorio && \
|
RUN mkdir -p /opt /factorio && \
|
||||||
apk add --update --no-cache pwgen && \
|
apk add --update --no-cache pwgen && \
|
||||||
@ -21,18 +25,19 @@ RUN mkdir -p /opt /factorio && \
|
|||||||
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
||||||
chmod ugo=rwx /opt/factorio && \
|
chmod ugo=rwx /opt/factorio && \
|
||||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
ln -s /factorio/saves /opt/factorio/saves && \
|
ln -s $SAVES /opt/factorio/saves && \
|
||||||
ln -s /factorio/mods /opt/factorio/mods && \
|
ln -s $MODS /opt/factorio/mods && \
|
||||||
|
ln -s $SCENARIOS /opt/factorio/scenarios && \
|
||||||
apk del .build-deps && \
|
apk del .build-deps && \
|
||||||
addgroup -g $PGID -S $GROUP && \
|
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
|
chown -R $USER:$GROUP /opt/factorio /factorio
|
||||||
|
|
||||||
VOLUME /factorio
|
VOLUME /factorio
|
||||||
|
|
||||||
EXPOSE $PORT/udp $RCON_PORT/tcp
|
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||||
|
|
||||||
COPY ./docker-entrypoint.sh /
|
COPY files/ /
|
||||||
|
|
||||||
USER $USER
|
USER $USER
|
||||||
|
|
||||||
|
@ -4,14 +4,10 @@ set -e
|
|||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
SAVES=/factorio/saves
|
|
||||||
CONFIG=/factorio/config
|
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p $SAVES
|
||||||
mkdir -p /factorio/mods
|
|
||||||
mkdir -p $CONFIG
|
mkdir -p $CONFIG
|
||||||
|
mkdir -p $MODS
|
||||||
#chown -R factorio /factorio
|
mkdir -p $SCENARIOS
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f $CONFIG/rconpw ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||||
@ -29,6 +25,10 @@ if [ ! -f $CONFIG/map-settings.json ]; then
|
|||||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
|
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
|
||||||
fi
|
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
|
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||||
/opt/factorio/bin/x64/factorio \
|
/opt/factorio/bin/x64/factorio \
|
||||||
--create $SAVES/_autosave1.zip \
|
--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
|
36
README.md
36
README.md
@ -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.16.23`, `0.16`, `latest` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
* `0.16.32`, `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.15.40`, `0.15`, `stable` [(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)
|
||||||
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/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.
|
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
|
## RCON
|
||||||
|
|
||||||
Set the RCON password in the `rconpw` file. A random password is generated if `rconpw` doesn't exist.
|
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
|
# Contributors
|
||||||
|
|
||||||
* [dtandersen](https://github.com/dtandersen/docker_factorio_server) - Maintainer
|
* [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
|
* [Zopanix](https://github.com/zopanix/docker_factorio_server) - Originator
|
||||||
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Randomly generate RCON password
|
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Randomly generate RCON password
|
||||||
* [gnomus](https://github.com/gnomus/docker_factorio_server) - White listing
|
* [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
|
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Version update
|
||||||
|
Reference in New Issue
Block a user