mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2024-11-10 12:47:24 +01:00
Merge remote-tracking branch 'remotes/origin/0.14.16'
# Conflicts: # Dockerfile # README.md
This commit is contained in:
commit
8fd01ef07f
36
Dockerfile
36
Dockerfile
@ -1,28 +1,24 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23
|
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||||
|
|
||||||
MAINTAINER zopanix <zopanix@gmail.com>
|
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||||
|
|
||||||
WORKDIR /opt
|
COPY ./factorio.crt /opt/factorio.crt
|
||||||
|
|
||||||
COPY ./smart_launch.sh /opt
|
ENV VERSION=0.14.16 \
|
||||||
COPY ./factorio.crt /opt
|
SHA1=e27c658bf8a7579b662a1c34815daa223e57bc90
|
||||||
|
|
||||||
|
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 "$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
|
||||||
|
|
||||||
VOLUME /opt/factorio/saves /opt/factorio/mods
|
VOLUME /opt/factorio/saves /opt/factorio/mods
|
||||||
|
|
||||||
ENV FACTORIO_AUTOSAVE_INTERVAL=2 \
|
EXPOSE 34197/udp 27015/tcp
|
||||||
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 && \
|
COPY ./docker-entrypoint.sh /
|
||||||
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"]
|
|
||||||
|
|
||||||
|
CMD ["/docker-entrypoint.sh"]
|
||||||
|
178
README.md
178
README.md
@ -1,102 +1,104 @@
|
|||||||
Factorio
|
# Supported tags and respective `Dockerfile` links
|
||||||
=====
|
|
||||||
Factorio Server in docker
|
|
||||||
|
|
||||||
Current Version
|
* `0.14.14` [(0.14.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.14/Dockerfile)
|
||||||
-----
|
* `0.12.32`, `latest` [(0.12.32/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.32/Dockerfile)
|
||||||
0.12.33
|
* `0.12.31` [(0.12.31/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.31/Dockerfile)
|
||||||
### What's new ?
|
* `0.12.30` [(0.12.30/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.30/Dockerfile)
|
||||||
#### 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
|
[![](https://imagelayers.io/badge/dtandersen/factorio:latest.svg)](https://imagelayers.io/?images=dtandersen/factorio:latest 'Get your own badge on imagelayers.io')
|
||||||
-----
|
|
||||||
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 ?
|
# What is Factorio?
|
||||||
-----
|
|
||||||
### I just want to play !
|
[Factorio](https://www.factorio.com) is a game in which you build and maintain factories.
|
||||||
This runs factorio with default settings, and your save will be kept :
|
|
||||||
```
|
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.
|
||||||
docker run -d \
|
|
||||||
-v [PATH]:/opt/factorio/saves \
|
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.
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
NOTE: This is only the server. The game is available on [Steam](http://store.steampowered.com/app/427520/).
|
||||||
```
|
|
||||||
* 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.
|
# Features
|
||||||
* 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.
|
|
||||||
|
* Configurable via ```server-config.json```.
|
||||||
|
* Automatically loads the last save.
|
||||||
|
* Volumes for saves and mods.
|
||||||
|
* Small size. Based on Alpine Linux.
|
||||||
|
|
||||||
|
# How to use this image?
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
Start the server in interactive mode for debugging. The game isn't saved.
|
||||||
|
|
||||||
### Advanced usage
|
|
||||||
#### Without map persistence
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker run --rm -it -P dtandersen/factorio
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
```
|
||||||
This will generate a new random map with default settings.
|
|
||||||
#### With map persistence
|
* ```--rm``` - Remove container after stopping
|
||||||
|
* ```-it``` - Interactive mode, i.e. you can see the console
|
||||||
|
* ```-P``` - Expose all ports.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Normally the server runs as a daemon and a configuration file is specified. Volumes are mounted for saves and mods.
|
||||||
|
|
||||||
|
Create ```server-config.json``` and modify it to your liking.
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker run -d -P \
|
||||||
-v [PATH]:/opt/factorio/saves \
|
-v /path/to/server-config.json:/opt/factorio/data/server-config.json \
|
||||||
-p [PORT]:34197/udp \
|
-v /path/to/saves:/opt/factorio/saves \
|
||||||
zopanix/factorio
|
-v /path/to/mods:/opt/factorio/mods \
|
||||||
|
--name factorio \
|
||||||
|
dtandersen/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.
|
* ```-d``` - Start the server as a daemon.
|
||||||
#### With existing map
|
* ```-P``` - Expose all ports.
|
||||||
|
* ```-v``` - Mount volumes for config, mods, and saves.
|
||||||
|
* ```--name``` - Give the container a name (otherwise it'll be random).
|
||||||
|
|
||||||
|
## Saves
|
||||||
|
|
||||||
|
The first time the server is started a new map is generated and saved as ```save.zip```. On subsequent runs the newest save is used. To load an old save ```touch save.zip``` and restart the server.
|
||||||
|
|
||||||
|
## Mods
|
||||||
|
|
||||||
|
Copy them into the mods folder and restart the server.
|
||||||
|
|
||||||
|
## Start/Stopping
|
||||||
|
|
||||||
|
Assuming the server is named ```factorio```, to stop the server:
|
||||||
|
|
||||||
```
|
```
|
||||||
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
|
To 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
|
## Volumes
|
||||||
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.
|
|
||||||
|
* ```/opt/factorio/saves``` - Saves (recommened)
|
||||||
|
* ```/opt/factorio/mods``` - Mods (optional)
|
||||||
|
* ```/opt/factorio/data/server-config.json``` - Configuration (recommended)
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
|
||||||
|
* ```34197/udp``` - Client (required)
|
||||||
|
* ```27015/tcp``` - Remote console (optional)
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
|
||||||
|
Sometimes it's useful to see the logs of a running container:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -d \
|
docker exec -it factorio tail -f /opt/factorio/factorio-current.log
|
||||||
--env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
```
|
||||||
Where [NUMBER] is the number of autosave slots.
|
|
||||||
#### Mounting mod volume
|
# Credits
|
||||||
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.
|
|
||||||
```
|
Based on [Zopanix' Factorio Server](https://github.com/zopanix/docker_factorio_server).
|
||||||
docker run -d \
|
|
||||||
-v [PATH]:/opt/factorio/mods \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
|
||||||
Where [PATH] is the path to the folder with your mods.
|
|
||||||
#### 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".
|
|
||||||
```
|
|
||||||
docker run -d \
|
|
||||||
--env FACTORIO_DISSALOW_COMMANDS=false \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
|
||||||
#### Activating no-auto-pause in the game when no one is on the server
|
|
||||||
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".
|
|
||||||
```
|
|
||||||
docker run -d \
|
|
||||||
--env FACTORIO_NO_AUTO_PAUSE=true \
|
|
||||||
-p [PORT]:34197/udp \
|
|
||||||
zopanix/factorio
|
|
||||||
```
|
|
||||||
### ToDo's
|
|
||||||
* Add cutom savename for people with a lot of saves
|
|
||||||
|
10
docker-entrypoint.sh
Executable file
10
docker-entrypoint.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
SAVES=/opt/factorio/saves
|
||||||
|
|
||||||
|
if [ ! -f $SAVES/*.zip ]
|
||||||
|
then
|
||||||
|
/opt/factorio/bin/x64/factorio --create $SAVES/save.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /opt/factorio/bin/x64/factorio --start-server-load-latest
|
6
run.sh
Executable file
6
run.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
sudo docker run --rm -it \
|
||||||
|
-v /home/vagrant/docker_factorio_server/server-settings.json:/opt/factorio/data/server-settings.json \
|
||||||
|
-v /data/mods:/opt/factorio/mods \
|
||||||
|
-v /data/saves:/opt/factorio/saves \
|
||||||
|
--name factorio \
|
||||||
|
factorio
|
57
server-settings.example.json
Normal file
57
server-settings.example.json
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"name": "Name of the game as it will appear in the game listing",
|
||||||
|
"description": "Description of the game that will appear in the listing",
|
||||||
|
"tags": ["game", "tags"],
|
||||||
|
|
||||||
|
"_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
|
||||||
|
"max_players": 0,
|
||||||
|
|
||||||
|
"_comment_visibility": ["public: Game will be published on the official Factorio matching server",
|
||||||
|
"lan: Game will be broadcast on LAN"],
|
||||||
|
"visibility":
|
||||||
|
{
|
||||||
|
"public": true,
|
||||||
|
"lan": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
|
||||||
|
"username": "",
|
||||||
|
"password": "",
|
||||||
|
|
||||||
|
"_comment_token": "Authentication token. May be used instead of 'password' above.",
|
||||||
|
"token": "",
|
||||||
|
|
||||||
|
"game_password": "",
|
||||||
|
|
||||||
|
"_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
|
||||||
|
"require_user_verification": true,
|
||||||
|
|
||||||
|
"_comment_max_upload_in_kilobytes_per_second" : "optional, default value is 0. 0 means unlimited.",
|
||||||
|
"max_upload_in_kilobytes_per_second": 0,
|
||||||
|
|
||||||
|
"_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
|
||||||
|
"ignore_player_limit_for_returning_players": false,
|
||||||
|
|
||||||
|
"_comment_allow_commands": "possible values are, true, false and admins-only",
|
||||||
|
"allow_commands": "admins-only",
|
||||||
|
|
||||||
|
"_comment_autosave_interval": "Autosave interval in minutes",
|
||||||
|
"autosave_interval": 10,
|
||||||
|
|
||||||
|
"_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
|
||||||
|
"autosave_slots": 5,
|
||||||
|
|
||||||
|
"_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
|
||||||
|
"afk_autokick_interval": 0,
|
||||||
|
|
||||||
|
"_comment_auto_pause": "Whether should the server be paused when no players are present.",
|
||||||
|
"auto_pause": true,
|
||||||
|
|
||||||
|
"only_admins_can_pause_the_game": true,
|
||||||
|
|
||||||
|
"_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
|
||||||
|
"autosave_only_on_server": true,
|
||||||
|
|
||||||
|
"_comment_admins": "List of case insensitive usernames, that will be promoted immediately",
|
||||||
|
"admins": []
|
||||||
|
}
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user