mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 06:28:05 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
d90f45bd41 | |||
2b201fea5b | |||
b0a64e5939 | |||
ef24dad0bf | |||
69a52f2c19 | |||
902ad53bd3 | |||
bd2af80a52 | |||
de9fb52d48 | |||
c0157e19ee | |||
8e7bca222a | |||
3e7c79ab74 | |||
979326ebf6 | |||
d5ac333364 | |||
e941e9a2c8 |
@ -9,8 +9,8 @@ ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.17.2 \
|
||||
SHA1=0f0931e3444befcd5e37abe912551f75f681c4ca \
|
||||
VERSION=0.17.4 \
|
||||
SHA1=30a7387e0450ecda8a48a9b56b18058c3f8a9f69 \
|
||||
SAVES=/factorio/saves \
|
||||
CONFIG=/factorio/config \
|
||||
MODS=/factorio/mods \
|
||||
@ -18,7 +18,7 @@ ENV PORT=34197 \
|
||||
SCRIPTOUTPUT=/factorio/script-output
|
||||
|
||||
RUN mkdir -p /opt /factorio && \
|
||||
apk add --update --no-cache pwgen su-exec && \
|
||||
apk add --update --no-cache pwgen su-exec binutils && \
|
||||
apk add --update --no-cache --virtual .build-deps curl && \
|
||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||
@ -34,10 +34,6 @@ RUN mkdir -p /opt /factorio && \
|
||||
addgroup -g $PGID -S $GROUP && \
|
||||
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
|
||||
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
|
||||
|
||||
|
@ -22,8 +22,7 @@ if [ ! -f $CONFIG/server-settings.json ]; then
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||
# TODO: Need a valid map-gen-settings.json
|
||||
# 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
|
||||
fi
|
||||
|
||||
@ -36,23 +35,24 @@ 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
|
||||
# Generate a new map if no save ZIPs exist
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/_autosave1.zip \
|
||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
||||
--map-settings $CONFIG/map-settings.json
|
||||
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
|
||||
chown -R factorio:factorio /opt/factorio/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
|
||||
# Generate a new map if no save ZIPs exist
|
||||
${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/_autosave1.zip \
|
||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
||||
--map-settings $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
||||
--port $PORT \
|
||||
--start-server-load-latest \
|
||||
|
22
README.md
22
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/)
|
||||
|
||||
* `0.17.2`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
|
||||
* `0.17.4`, `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.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)
|
||||
@ -195,20 +195,22 @@ The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||
|
||||
To keep things simple, the container uses a single volume mounted at `/factorio`. This volume stores configuration, mods, and saves.
|
||||
|
||||
The files in this volume should be owned by the factorio user, uid 845.
|
||||
|
||||
factorio
|
||||
|-- config
|
||||
| |-- map-gen-settings.json
|
||||
| |-- map-settings.json
|
||||
| |-- rconpw
|
||||
| |-- server-settings.json
|
||||
| |-- server-whitelist.json
|
||||
| |-- server-adminlist.json
|
||||
| |-- server-banlist.json
|
||||
| `-- server-adminlist.json
|
||||
| |-- server-settings.json
|
||||
| `-- server-whitelist.json
|
||||
|-- mods
|
||||
| `-- fancymod.zip
|
||||
`-- saves
|
||||
`-- _autosave1.zip
|
||||
|
||||
|
||||
## Docker Compose
|
||||
|
||||
[Docker Compose](https://docs.docker.com/compose/install/) is an easy way to run Docker containers.
|
||||
@ -280,17 +282,17 @@ sudo docker run -d \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
VirtualBox users must enable Bridged networking in order for the host to be assigned an internal network IP. Enable Bridged networking in Vagrant with:
|
||||
## Vagrant
|
||||
|
||||
[Vagrant](https://www.vagrantup.com/) is a easy way to setup a virtual machine (VM) to run Docker. The [Factorio Vagrant box repository](https://github.com/dtandersen/factorio-lan-vagrant) contains a sample Vagrantfile.
|
||||
|
||||
For LAN games the VM needs an internal IP in order for clients to connect. One way to do this is with a public network. The VM uses DHCP to acquire an IP address. The VM must also forward port 34197.
|
||||
|
||||
```
|
||||
config.vm.network "public_network"
|
||||
config.vm.network "forwarded_port", guest: 34197, host: 34197
|
||||
```
|
||||
|
||||
## Vagrant
|
||||
|
||||
Vagrant is a good way for those without a Linux machine to try Docker. Check out the [Factorio Vagrant Box](https://github.com/dtandersen/factorio-lan-vagrant).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**My server is listed in the server browser, but nobody can connect**
|
||||
|
Reference in New Issue
Block a user