mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-04 07:58:13 +02:00
Compare commits
111 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b70d806ad | |||
433155549f | |||
e7afbf7043 | |||
66a931efea | |||
0df69d27ba | |||
8b76ac8c69 | |||
39569f1ea2 | |||
8042aed70f | |||
52b9a5a0a5 | |||
bad5c783d7 | |||
72798cda20 | |||
57b221d308 | |||
7dd16c1e3a | |||
7fe00ee1e1 | |||
2600a90c4e | |||
67e6e928a6 | |||
3643eebca1 | |||
012180bae6 | |||
ff2bfae329 | |||
0309a94ed9 | |||
d10a30c01f | |||
52840aff65 | |||
07b066754d | |||
c6c76b5a41 | |||
9fbd7d92bc | |||
ef731d433a | |||
35ee88bf7f | |||
fb0d9e444b | |||
b99b296865 | |||
7bedca570d | |||
9a0de68628 | |||
08a2732ee3 | |||
c8d64cc1db | |||
f096877853 | |||
bf83c650bc | |||
7205f9fb2a | |||
f9fbd2a59f | |||
9fcbb9ba24 | |||
60308b60fc | |||
f170800d8f | |||
4f71f75b72 | |||
d73235ea9e | |||
7ea6fa3274 | |||
a511769e70 | |||
c5f4b8860e | |||
6e92b0f850 | |||
97cf42b229 | |||
007503b7c6 | |||
4b6fc187dc | |||
dc0034f00d | |||
487b0d7bd6 | |||
1c82a0fb65 | |||
6bfeb9dabf | |||
33a9379f9f | |||
35eb0fbfb7 | |||
ff1c0a954e | |||
4280ef8cfc | |||
2cefc1544c | |||
1c07730c4e | |||
cf4d1cb218 | |||
d52709ff0f | |||
7992ded59e | |||
06e168f899 | |||
a3ad4c25a1 | |||
4cde518f36 | |||
616d78c45f | |||
730bb5d604 | |||
f379330b7c | |||
a9bb898fb2 | |||
6c787666a4 | |||
1a4e5df5a7 | |||
52dcbafedb | |||
d88da771e9 | |||
f2c9fbb10c | |||
47d6cfb2b1 | |||
1e97a95302 | |||
3f8621f896 | |||
05a3ca45e4 | |||
fc42bf7863 | |||
1dbac7408f | |||
9261339510 | |||
8e1a044172 | |||
b85b998062 | |||
f3b4d8e445 | |||
4a48f9234f | |||
8d90253929 | |||
aca4709d7f | |||
a2ebf4db2d | |||
ec17a32638 | |||
15da4f79f5 | |||
68e8a5f25c | |||
1d3fc75d20 | |||
a4a482ee91 | |||
eafe7c08be | |||
3e9f74eaac | |||
14bbd68a3b | |||
d4052bc790 | |||
2fc2b7656d | |||
199f6c7f59 | |||
d614babc54 | |||
257e1751c2 | |||
d089b02941 | |||
6fe77c30da | |||
a97763a0e1 | |||
602881a0d9 | |||
b56ab27e52 | |||
5edbcd9055 | |||
059a77574e | |||
fb0d7d955b | |||
a34b260d15 | |||
5d5cb71a90 |
28
0.13/Dockerfile
Normal file
28
0.13/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||||
|
|
||||||
|
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||||
|
|
||||||
|
COPY ./factorio.crt /opt/factorio.crt
|
||||||
|
|
||||||
|
ENV VERSION=0.13.20 \
|
||||||
|
SHA1=59ed0edb3f62f0f41a01fc291959b0a8b44cf631
|
||||||
|
|
||||||
|
RUN apk --no-cache add curl tini pwgen && \
|
||||||
|
curl -sSL --cacert /opt/factorio.crt \
|
||||||
|
https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||||
|
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||||
|
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||||
|
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
|
||||||
|
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||||
|
apk del curl && \
|
||||||
|
ln -s /factorio/saves /opt/factorio/saves && \
|
||||||
|
ln -s /factorio/mods /opt/factorio/mods
|
||||||
|
|
||||||
|
VOLUME /factorio
|
||||||
|
|
||||||
|
EXPOSE 34197/udp 27015/tcp
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
1
0.13/build.sh
Executable file
1
0.13/build.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
sudo docker build -t dtandersen/factorio:0.13-dev .
|
1
0.13/clean.sh
Executable file
1
0.13/clean.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
sudo rm -rf /tmp/factorio
|
35
0.13/docker-entrypoint.sh
Executable file
35
0.13/docker-entrypoint.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh -x
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SAVES=/factorio/saves
|
||||||
|
CONFIG=/factorio/config
|
||||||
|
|
||||||
|
mkdir -p $SAVES
|
||||||
|
mkdir -p /factorio/mods
|
||||||
|
mkdir -p $CONFIG
|
||||||
|
|
||||||
|
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 ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||||
|
/opt/factorio/bin/x64/factorio \
|
||||||
|
--create $SAVES/_autosave1.zip \
|
||||||
|
--map-gen-settings $CONFIG/map-gen-settings.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
|
--port 34197 \
|
||||||
|
--start-server-load-latest \
|
||||||
|
--server-settings $CONFIG/server-settings.json \
|
||||||
|
--rcon-port 27015 \
|
||||||
|
--rcon-password "$(cat $CONFIG/rconpw)"
|
5
0.13/run.sh
Executable file
5
0.13/run.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
sudo docker run --rm -it \
|
||||||
|
-v /tmp/factorio:/factorio \
|
||||||
|
--name factorio \
|
||||||
|
dtandersen/factorio:0.13-dev "$@"
|
||||||
|
find /tmp/factorio -type f
|
26
0.14/Dockerfile
Normal file
26
0.14/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||||
|
|
||||||
|
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||||
|
|
||||||
|
ENV VERSION=0.14.20 \
|
||||||
|
SHA1=d7c93754b543270aaa170aee01d8fd75fcc32c58
|
||||||
|
|
||||||
|
RUN mkdir /opt && \
|
||||||
|
apk --no-cache add curl tini pwgen && \
|
||||||
|
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||||
|
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||||
|
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||||
|
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
|
||||||
|
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||||
|
apk del curl && \
|
||||||
|
ln -s /factorio/saves /opt/factorio/saves && \
|
||||||
|
ln -s /factorio/mods /opt/factorio/mods
|
||||||
|
|
||||||
|
VOLUME /factorio
|
||||||
|
|
||||||
|
EXPOSE 34197/udp 27015/tcp
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
1
0.14/build.sh
Executable file
1
0.14/build.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
sudo docker build --no-cache -t factorio .
|
1
0.14/clean.sh
Executable file
1
0.14/clean.sh
Executable file
@ -0,0 +1 @@
|
|||||||
|
sudo rm -rf /tmp/factorio
|
35
0.14/docker-entrypoint.sh
Executable file
35
0.14/docker-entrypoint.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh -x
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SAVES=/factorio/saves
|
||||||
|
CONFIG=/factorio/config
|
||||||
|
|
||||||
|
mkdir -p $SAVES
|
||||||
|
mkdir -p /factorio/mods
|
||||||
|
mkdir -p $CONFIG
|
||||||
|
|
||||||
|
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 ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||||
|
/opt/factorio/bin/x64/factorio \
|
||||||
|
--create $SAVES/_autosave1.zip \
|
||||||
|
--map-gen-settings $CONFIG/map-gen-settings.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
|
--port 34197 \
|
||||||
|
--start-server-load-latest \
|
||||||
|
--server-settings $CONFIG/server-settings.json \
|
||||||
|
--rcon-port 27015 \
|
||||||
|
--rcon-password "$(cat $CONFIG/rconpw)"
|
5
0.14/run.sh
Executable file
5
0.14/run.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
sudo docker run --rm -it \
|
||||||
|
-v /tmp/factorio:/factorio \
|
||||||
|
--name factorio \
|
||||||
|
factorio "$@"
|
||||||
|
find /tmp/factorio -type f
|
28
Dockerfile
28
Dockerfile
@ -1,28 +0,0 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23
|
|
||||||
|
|
||||||
MAINTAINER zopanix <zopanix@gmail.com>
|
|
||||||
|
|
||||||
WORKDIR /opt
|
|
||||||
|
|
||||||
COPY ./smart_launch.sh /opt
|
|
||||||
COPY ./factorio.crt /opt
|
|
||||||
|
|
||||||
VOLUME /opt/factorio/saves /opt/factorio/mods
|
|
||||||
|
|
||||||
ENV FACTORIO_AUTOSAVE_INTERVAL=2 \
|
|
||||||
FACTORIO_AUTOSAVE_SLOTS=3 \
|
|
||||||
FACTORIO_DISSALOW_COMMANDS=true \
|
|
||||||
FACTORIO_NO_AUTO_PAUSE=false \
|
|
||||||
VERSION=0.12.33 \
|
|
||||||
FACTORIO_SHA1=9802b22f428eb404369d496f6d40633a64984406
|
|
||||||
|
|
||||||
RUN apk --update add bash curl && \
|
|
||||||
curl -sSL --cacert /opt/factorio.crt https://www.factorio.com/get-download/$VERSION/headless/linux64 -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
|
||||||
echo "$FACTORIO_SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
|
||||||
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
|
||||||
rm /tmp/factorio_headless_x64_$VERSION.tar.gz
|
|
||||||
|
|
||||||
EXPOSE 34197/udp
|
|
||||||
|
|
||||||
CMD ["./smart_launch.sh"]
|
|
||||||
|
|
208
README.md
208
README.md
@ -1,102 +1,130 @@
|
|||||||
Factorio
|
# Factorio [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
||||||
=====
|
|
||||||
Factorio Server in docker
|
|
||||||
|
|
||||||
Current Version
|
* `0.14.20`, `0.14`, `latest` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
||||||
-----
|
* `0.14.19`, `stable` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.19/0.14/Dockerfile)
|
||||||
0.12.33
|
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
|
||||||
### What's new ?
|
|
||||||
#### Factorio
|
|
||||||
See [factorio's site](http://www.factorio.com)
|
|
||||||
#### Docker image
|
|
||||||
Next feature come from dtandersen's fork:
|
|
||||||
* Image based on alpine (makes the image more lightweight)
|
|
||||||
* SSL verification when downloading game
|
|
||||||
|
|
||||||
Versions
|
# What is Factorio?
|
||||||
-----
|
|
||||||
I'm keeping the image up to date. If you need to use an older version, checkout out the different [tags](https://hub.docker.com/r/zopanix/factorio/tags/).
|
|
||||||
|
|
||||||
How to use ?
|
[Factorio](https://www.factorio.com) is a game in which you build and maintain factories.
|
||||||
-----
|
|
||||||
### I just want to play !
|
You will be mining resources, researching technologies, building infrastructure, automating production and fighting enemies. Use your imagination to design your factory, combine simple elements into ingenious structures, apply management skills to keep it working and finally protect it from the creatures who don't really like you.
|
||||||
This runs factorio with default settings, and your save will be kept :
|
|
||||||
```
|
The game is very stable and optimized for building massive factories. You can create your own maps, write mods in Lua or play with friends via Multiplayer.
|
||||||
docker run -d \
|
|
||||||
-v [PATH]:/opt/factorio/saves \
|
NOTE: This is only the server. The game is available at [factorio.com](https://www.factorio.com) and [Steam](http://store.steampowered.com/app/427520/).
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
# Usage
|
||||||
* Where [PATH] is a folder where you'll put your saves, if there already is a save in it with the string "save", that one will be taken by default, otherwize, a new one will be made.
|
|
||||||
* Where [PORT] is the port number you choose, if you're going to launch it on your local machine, don't use the port 34197, take another one at random.
|
## Quick Start
|
||||||
|
|
||||||
|
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
|
||||||
|
|
||||||
### Advanced usage
|
|
||||||
#### Without map persistence
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
|
||||||
-p [PORT]:34197/udp \
|
-v /tmp/factorio:/factorio \
|
||||||
zopanix/factorio
|
--name factorio \
|
||||||
|
--restart=always \
|
||||||
|
dtandersen/factorio
|
||||||
```
|
```
|
||||||
This will generate a new random map with default settings.
|
|
||||||
#### With map persistence
|
For those new to Docker, here is an explanation of the options:
|
||||||
|
|
||||||
|
* `-d` - Run as a daemon ("detached").
|
||||||
|
* `-p` - Expose ports.
|
||||||
|
* `-v` - Mount `/tmp/factorio` on the local file system to `/factorio` in the container.
|
||||||
|
* `--restart` - Restart the server if it crashes and at system start
|
||||||
|
* `--name` - Name the container "factorio" (otherwise it has a funny random name).
|
||||||
|
|
||||||
|
Check the logs to see what happened:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker logs factorio
|
||||||
-v [PATH]:/opt/factorio/saves \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
```
|
||||||
This will generate a new random map with default settings and save it onto the volume.
|
|
||||||
Replace [PATH] with a path to a folder on the host where the map will be saved.
|
Stop the server:
|
||||||
#### With existing map
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker stop factorio
|
||||||
-v [PATH]:/opt/factorio/saves \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
```
|
||||||
It's the same as above, it takes the last modified file which contains the word save in the filename as current save when booting the server. This allows when upgrading the container to take the last save, you don't have to rename the last autosave as save.zip
|
|
||||||
#### Autosave interval
|
Now there's a `server-settings.json` file in the folder `/tmp/factorio/config`. Modify this to your liking and restart the server:
|
||||||
You can set the autosave interval. By default it is set at 2 minutes bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_INTERVAL" variable to whatever suits you best.
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker start factorio
|
||||||
--env FACTORIO_AUTOSAVE_INTERVAL=[NUMBER] \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
```
|
||||||
Where [NUMBER] is the number of minutes between autosaves.
|
|
||||||
#### Autosave slots
|
Try to connect to the server. Check the logs if it isn't working.
|
||||||
You can set the number of autosave slots. By default it is set at 3 slots bud you can change it by launching the container with the "FACTORIO_AUTOSAVE_SLOTS" variable to whatever suits you best.
|
|
||||||
```
|
|
||||||
docker run -d \
|
## Saves
|
||||||
--env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \
|
|
||||||
-p [PORT]:34197/udp \
|
A new map named `_autosave1.zip` is generated the first time the server is started. The `map-gen-settings.json` file in `/tmp/factorio/config` is used for the map settings. On subsequent runs the newest save is used.
|
||||||
zopanix/factorio
|
|
||||||
```
|
To load an old save stop the server and run the command `touch oldsave.zip`. This resets the date. Then restart the server. Another option is to delete all saves except one.
|
||||||
Where [NUMBER] is the number of autosave slots.
|
|
||||||
#### Mounting mod volume
|
To generate a new map stop the server, delete all of the saves and restart the server.
|
||||||
As everybody knows about factorio is you can add mods to it. Now you can also do it in this docker image by mounting a volume.
|
|
||||||
```
|
|
||||||
docker run -d \
|
## Mods
|
||||||
-v [PATH]:/opt/factorio/mods \
|
|
||||||
-p [PORT]:34197/udp \
|
Copy mods into the mods folder and restart the server.
|
||||||
zopanix/factorio
|
|
||||||
```
|
|
||||||
Where [PATH] is the path to the folder with your mods.
|
## RCON
|
||||||
#### Allowing in-game commands
|
|
||||||
I've always disabled in-game commands because I think it is like cheating, however, you can enable them by setting the the "FACTORIO_DISSALOW_COMMANDS" variable to "false".
|
Set the RCON password in the `rconpw` file. A random password is generated if `rconpw` doesn't exist.
|
||||||
```
|
|
||||||
docker run -d \
|
To change the password stop the server, modify `rconpw`, and restart the server.
|
||||||
--env FACTORIO_DISSALOW_COMMANDS=false \
|
|
||||||
-p [PORT]:34197/udp \
|
To "disable" RCON don't expose port 27015, i.e. start the server with `-p 34197:34197/udp` instead of `-P`. RCON still runs, but nobody is able to connect to it.
|
||||||
zopanix/factorio
|
|
||||||
```
|
|
||||||
#### Activating no-auto-pause in the game when no one is on the server
|
# Container Details
|
||||||
I do not recommend this feature, bud it can make the game more difficult if you're up for a challenge :-). Just set the "FACTORIO_NO_AUTO_PAUSE" variable to "true".
|
|
||||||
```
|
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||||
docker run -d \
|
|
||||||
--env FACTORIO_NO_AUTO_PAUSE=true \
|
* The server should bootstrap itself.
|
||||||
-p [PORT]:34197/udp \
|
* Prefer configuration files over environment variables.
|
||||||
zopanix/factorio
|
* Use one volume for data.
|
||||||
```
|
|
||||||
### ToDo's
|
|
||||||
* Add cutom savename for people with a lot of saves
|
## Volumes
|
||||||
|
|
||||||
|
To keep things simple, the container uses a single volume mounted at `/factorio`. This volume stores configuration, mods, and saves.
|
||||||
|
|
||||||
|
factorio
|
||||||
|
|-- config
|
||||||
|
| |-- map-gen-settings.json
|
||||||
|
| |-- rconpw
|
||||||
|
| `-- server-settings.json
|
||||||
|
|-- mods
|
||||||
|
| `-- fancymod.zip
|
||||||
|
`-- saves
|
||||||
|
`-- _autosave1.zip
|
||||||
|
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
|
||||||
|
* `34197/udp` - Factorio clients (required).
|
||||||
|
* `27015/tcp` - RCON (optional).
|
||||||
|
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
**My server is listed in the server browser, but nobody can connect**
|
||||||
|
|
||||||
|
Check the logs. If there is the line `Own address is RIGHT IP:WRONG PORT`, then this could be caused by the Docker proxy. If the the IP and port is correct it's probably a port forwarding or firewall issue instead.
|
||||||
|
|
||||||
|
By default, Docker routes traffic through a proxy. The proxy changes the source UDP port, so the wrong port is detected. See the forum post *[Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255)* for details.
|
||||||
|
|
||||||
|
To fix the incorrect port, start the Docker service with the `--userland-proxy=false` switch. Docker will route traffic with iptables rules instead of a proxy. Add the switch to the `DOCKER_OPTS` environment variable or `ExecStart` in the Docker systemd service definition. The specifics vary by operating system.
|
||||||
|
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
|
||||||
|
Ideas borrowed from:
|
||||||
|
|
||||||
|
* [Zopanix](https://github.com/zopanix/docker_factorio_server)
|
||||||
|
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio)
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ -f /opt/factorio/saves/save.zip ]
|
|
||||||
then
|
|
||||||
echo "###"
|
|
||||||
echo "# Using existing map [save.zip]"
|
|
||||||
echo "###"
|
|
||||||
echo "###"
|
|
||||||
echo "# Finding latest map"
|
|
||||||
echo "###"
|
|
||||||
last_save=$(ls /opt/factorio/saves -lt | grep save |head -1 |awk '{print $(NF)}')
|
|
||||||
else
|
|
||||||
echo "###"
|
|
||||||
echo "# Creating a new map [save.zip]"
|
|
||||||
echo "###"
|
|
||||||
/opt/factorio/bin/x64/factorio --create save.zip
|
|
||||||
last_save="save.zip"
|
|
||||||
echo "###"
|
|
||||||
echo "# New map created [save.zip]"
|
|
||||||
echo "###"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checking options
|
|
||||||
if [ "$FACTORIO_DISSALOW_COMMANDS" == false ]; then
|
|
||||||
disallow_commands=""
|
|
||||||
else
|
|
||||||
disallow_commands="--disallow-commands"
|
|
||||||
fi
|
|
||||||
if [ "$FACTORIO_NO_AUTO_PAUSE" == true ]; then
|
|
||||||
no_auto_pause="--no-auto-pause"
|
|
||||||
else
|
|
||||||
no_auto_pause=""
|
|
||||||
fi
|
|
||||||
echo "###"
|
|
||||||
echo "# Launching Game"
|
|
||||||
echo "###"
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
|
||||||
$disallow_commands \
|
|
||||||
$no_auto_pause \
|
|
||||||
--autosave-interval ${FACTORIO_AUTOSAVE_INTERVAL} \
|
|
||||||
--autosave-slots ${FACTORIO_AUTOSAVE_SLOTS} \
|
|
||||||
--start-server \
|
|
||||||
$last_save
|
|
Reference in New Issue
Block a user