mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 22:48:26 +02:00
Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
18153f3f46 | |||
62e1a9f266 | |||
be7ecddb0d | |||
43599d0c23 | |||
6fb4cbc600 | |||
fe0e8f9b91 | |||
f76e88cea1 | |||
cbaa20cdea | |||
b3c134d396 | |||
9bdb79b494 | |||
77d83b4152 | |||
25d4edf14f | |||
e16b111c0b | |||
09e1ad2045 | |||
2efa39084f | |||
77edb05109 | |||
2eea2a25e4 | |||
98ea8a27c1 | |||
956af65a2b | |||
b5c1dff7b4 | |||
ee5b023911 | |||
045ef7a214 | |||
bbc2d42302 | |||
0173eab54c | |||
f868aa16ad | |||
5cd0c40975 | |||
778d982c6d | |||
9d2c38df65 | |||
b2a4195e13 | |||
18ccac666d | |||
830d042e4b | |||
a0868ba653 | |||
7002778ab5 | |||
44371283b6 | |||
d421adab67 | |||
b0cedbbe1b | |||
010b96e0b0 | |||
621ccf4282 | |||
1204b97fca | |||
aef16e83a7 | |||
605ca74c0e | |||
e34180ca51 | |||
0db1dde077 | |||
e8aeb461a9 | |||
46f24b0b7a | |||
6d92825f56 | |||
55fdc2e0de | |||
57c9f59f46 | |||
8f15b73d7b | |||
ecc54400ba | |||
eea1d550f2 | |||
730b2c334b | |||
288f080ebc | |||
2ffac3c4a8 | |||
88fed15bb4 | |||
968fb8a3bd | |||
9d642d8fb0 | |||
4c3818b27c | |||
a6d480d695 | |||
fce556160a | |||
4727f62a8f | |||
64cbf48082 | |||
dd6bc76827 | |||
b7108c64cb |
14
.hadolint.yaml
Normal file
14
.hadolint.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
ignored:
|
||||||
|
# ignore apt version pinning
|
||||||
|
- DL3008
|
||||||
|
# ignore pip version pinning
|
||||||
|
- DL3013
|
||||||
|
# ignore apk version pinning
|
||||||
|
- DL3018
|
||||||
|
# ignore pipefail cause Balena/resin.io images do not work with it
|
||||||
|
- DL4006
|
||||||
|
# ignore false positive regex
|
||||||
|
- SC1083
|
||||||
|
- SC2086
|
||||||
|
# ignore as need for debug
|
||||||
|
- SC2005
|
27
.travis.yml
Normal file
27
.travis.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
dist: xenial
|
||||||
|
sudo: required
|
||||||
|
language: bash
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- jq
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
- stage: test
|
||||||
|
script:
|
||||||
|
- git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 -I{} sh -c 'docker run --rm -i -v ${PWD}/.hadolint.yaml:/.hadolint.yaml hadolint/hadolint < "$1"' -- {}
|
||||||
|
- bash -c 'shopt -s globstar; shellcheck **/*.sh'
|
||||||
|
- &build
|
||||||
|
stage: build
|
||||||
|
env: VERSION_SHORT=0.17 EXTRA_TAG=latest
|
||||||
|
script:
|
||||||
|
- ./build.sh $VERSION_SHORT
|
||||||
|
- <<: *build
|
||||||
|
env: VERSION_SHORT=0.16 EXTRA_TAG=stable
|
||||||
|
- <<: *build
|
||||||
|
env: VERSION_SHORT=0.15
|
||||||
|
- <<: *build
|
||||||
|
env: VERSION_SHORT=0.14
|
@ -1,11 +1,11 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.4
|
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||||
|
|
||||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||||
|
|
||||||
ENV VERSION=0.14.23 \
|
ENV VERSION=0.14.23 \
|
||||||
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
|
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
|
||||||
|
|
||||||
RUN mkdir /opt && \
|
RUN mkdir -p /opt && \
|
||||||
apk --no-cache add curl tini pwgen && \
|
apk --no-cache add curl tini pwgen && \
|
||||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||||
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
sudo docker build --no-cache -t factorio .
|
sudo docker build --no-cache -t factorio .
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
sudo rm -rf /tmp/factorio
|
sudo rm -rf /tmp/factorio
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
SAVES=/factorio/saves
|
SAVES=/factorio/saves
|
||||||
CONFIG=/factorio/config
|
CONFIG=/factorio/config
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p /factorio/mods
|
mkdir -p /factorio/mods
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f $CONFIG/rconpw ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1 >"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
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" \
|
||||||
--map-gen-settings $CONFIG/map-gen-settings.json
|
--map-gen-settings "$CONFIG/map-gen-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--port 34197 \
|
--port 34197 \
|
||||||
--start-server-load-latest \
|
--start-server-load-latest \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--rcon-port 27015 \
|
--rcon-port 27015 \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)"
|
--rcon-password "$(cat "$CONFIG/rconpw")"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
sudo docker run --rm -it \
|
sudo docker run --rm -it \
|
||||||
-v /tmp/factorio:/factorio \
|
-v /tmp/factorio:/factorio \
|
||||||
--name factorio \
|
--name factorio \
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.6
|
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||||
|
|
||||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||||
|
|
||||||
ENV PORT=34197 \
|
ENV PORT=34197 \
|
||||||
RCON_PORT=27015 \
|
RCON_PORT=27015 \
|
||||||
VERSION=0.15.40 \
|
VERSION=0.15.40 \
|
||||||
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
|
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
|
||||||
|
|
||||||
RUN mkdir /opt && \
|
RUN mkdir -p /opt && \
|
||||||
apk add --update --no-cache tini pwgen && \
|
apk add --update --no-cache tini pwgen && \
|
||||||
apk add --update --no-cache --virtual .build-deps curl && \
|
apk add --update --no-cache --virtual .build-deps curl && \
|
||||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
SAVES=/factorio/saves
|
SAVES=/factorio/saves
|
||||||
CONFIG=/factorio/config
|
CONFIG=/factorio/config
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p /factorio/mods
|
mkdir -p /factorio/mods
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1 >"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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 \*.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" \
|
||||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
--map-gen-settings "$CONFIG/map-gen-settings.json" \
|
||||||
--map-settings $CONFIG/map-settings.json
|
--map-settings "$CONFIG/map-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--port $PORT \
|
--port "$PORT" \
|
||||||
--start-server-load-latest \
|
--start-server-load-latest \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist "$CONFIG/server-banlist.json" \
|
||||||
--rcon-port $RCON_PORT \
|
--rcon-port "$RCON_PORT" \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||||
--server-id /factorio/config/server-id.json
|
--server-id /factorio/config/server-id.json
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.7
|
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||||
|
|
||||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||||
|
|
||||||
ARG USER=factorio
|
ARG USER=factorio
|
||||||
ARG GROUP=factorio
|
ARG GROUP=factorio
|
||||||
@ -15,10 +15,12 @@ ENV PORT=34197 \
|
|||||||
CONFIG=/factorio/config \
|
CONFIG=/factorio/config \
|
||||||
MODS=/factorio/mods \
|
MODS=/factorio/mods \
|
||||||
SCENARIOS=/factorio/scenarios \
|
SCENARIOS=/factorio/scenarios \
|
||||||
SCRIPTOUTPUT=/factorio/script-output
|
SCRIPTOUTPUT=/factorio/script-output \
|
||||||
|
PUID="$PUID" \
|
||||||
|
PGID="$PGID"
|
||||||
|
|
||||||
RUN mkdir -p /opt /factorio && \
|
RUN mkdir -p /opt /factorio && \
|
||||||
apk add --update --no-cache pwgen && \
|
apk add --update --no-cache pwgen su-exec shadow && \
|
||||||
apk add --update --no-cache --virtual .build-deps curl && \
|
apk add --update --no-cache --virtual .build-deps curl && \
|
||||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||||
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
@ -41,6 +43,4 @@ EXPOSE $PORT/udp $RCON_PORT/tcp
|
|||||||
|
|
||||||
COPY files/ /
|
COPY files/ /
|
||||||
|
|
||||||
USER $USER
|
|
||||||
|
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
@ -1,48 +1,62 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
mkdir -p $SAVES
|
FACTORIO_VOL=/factorio
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$FACTORIO_VOL"
|
||||||
mkdir -p $MODS
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $SCRIPTOUTPUT
|
mkdir -p "$MODS"
|
||||||
|
mkdir -p "$SCENARIOS"
|
||||||
|
mkdir -p "$SCRIPTOUTPUT"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1>"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
if find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
|
||||||
rm -f $SAVES/*.tmp.zip
|
rm -f "$SAVES"/*.tmp.zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
if [ "$(id -u)" = '0' ]; then
|
||||||
/opt/factorio/bin/x64/factorio \
|
# Update the User and Group ID based on the PUID/PGID variables
|
||||||
--create $SAVES/_autosave1.zip \
|
usermod -o -u "$PUID" factorio
|
||||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
groupmod -o -g "$PGID" factorio
|
||||||
--map-settings $CONFIG/map-settings.json
|
# Take ownership of factorio data if running as root
|
||||||
|
chown -R factorio:factorio "$FACTORIO_VOL"
|
||||||
|
# Drop to the factorio user
|
||||||
|
SU_EXEC="su-exec factorio"
|
||||||
|
else
|
||||||
|
SU_EXEC=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||||
--port $PORT \
|
$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
|
||||||
|
|
||||||
|
$SU_EXEC /opt/factorio/bin/x64/factorio \
|
||||||
|
--port "$PORT" \
|
||||||
--start-server-load-latest \
|
--start-server-load-latest \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist "$CONFIG/server-banlist.json" \
|
||||||
--rcon-port $RCON_PORT \
|
--rcon-port "$RCON_PORT" \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||||
--server-id /factorio/config/server-id.json \
|
--server-id /factorio/config/server-id.json \
|
||||||
$@
|
"$@"
|
||||||
|
@ -1,44 +1,42 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
echo "No argument supplied"
|
||||||
echo "No argument supplied"
|
|
||||||
fi
|
fi
|
||||||
SCENARIO=$1
|
SERVER_SCENARIO=$1
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $MODS
|
mkdir -p "$MODS"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$SCENARIOS"
|
||||||
|
|
||||||
#chown -R factorio /factorio
|
#chown -R factorio /factorio
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1 >"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
||||||
|
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--port $PORT \
|
--port "$PORT" \
|
||||||
--start-server-load-scenario $SCENARIO \
|
--start-server-load-scenario "$SERVER_SCENARIO" \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist "$CONFIG/server-banlist.json" \
|
||||||
--rcon-port $RCON_PORT \
|
--rcon-port "$RCON_PORT" \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||||
--server-id /factorio/config/server-id.json
|
--server-id /factorio/config/server-id.json
|
||||||
|
@ -1,30 +1,29 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
echo "No argument supplied"
|
||||||
echo "No argument supplied"
|
|
||||||
fi
|
fi
|
||||||
SCENARIO=$1
|
SERVER_SCENARIO=$1
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $MODS
|
mkdir -p "$MODS"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$SCENARIOS"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--scenario2map $SCENARIO
|
--scenario2map "$SERVER_SCENARIO"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||||
|
|
||||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||||
|
|
||||||
ARG USER=factorio
|
ARG USER=factorio
|
||||||
ARG GROUP=factorio
|
ARG GROUP=factorio
|
||||||
@ -9,31 +9,33 @@ ARG PGID=845
|
|||||||
|
|
||||||
ENV PORT=34197 \
|
ENV PORT=34197 \
|
||||||
RCON_PORT=27015 \
|
RCON_PORT=27015 \
|
||||||
VERSION=0.17.19 \
|
VERSION=0.17.50 \
|
||||||
SHA1=ff9a73090acfdd5f04290b7a65f93f444d3ebd3b \
|
SHA1=91a8300b38220dc688185294eac5df4a50b2b693 \
|
||||||
SAVES=/factorio/saves \
|
SAVES=/factorio/saves \
|
||||||
CONFIG=/factorio/config \
|
CONFIG=/factorio/config \
|
||||||
MODS=/factorio/mods \
|
MODS=/factorio/mods \
|
||||||
SCENARIOS=/factorio/scenarios \
|
SCENARIOS=/factorio/scenarios \
|
||||||
SCRIPTOUTPUT=/factorio/script-output
|
SCRIPTOUTPUT=/factorio/script-output \
|
||||||
|
PUID="$PUID" \
|
||||||
|
PGID="$PGID"
|
||||||
|
|
||||||
RUN mkdir -p /opt /factorio && \
|
RUN mkdir -p /opt /factorio && \
|
||||||
apk add --update --no-cache pwgen su-exec binutils gettext libintl && \
|
apk add --update --no-cache pwgen su-exec binutils gettext libintl shadow && \
|
||||||
apk add --update --no-cache --virtual .build-deps curl && \
|
apk add --update --no-cache --virtual .build-deps curl && \
|
||||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" \
|
||||||
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
||||||
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 $SAVES /opt/factorio/saves && \
|
ln -s "$SAVES" /opt/factorio/saves && \
|
||||||
ln -s $MODS /opt/factorio/mods && \
|
ln -s "$MODS" /opt/factorio/mods && \
|
||||||
ln -s $SCENARIOS /opt/factorio/scenarios && \
|
ln -s "$SCENARIOS" /opt/factorio/scenarios && \
|
||||||
ln -s $SCRIPTOUTPUT /opt/factorio/script-output && \
|
ln -s "$SCRIPTOUTPUT" /opt/factorio/script-output && \
|
||||||
apk del .build-deps && \
|
apk del .build-deps && \
|
||||||
addgroup -g $PGID -S $GROUP && \
|
addgroup -g "$PGID" -S "$GROUP" && \
|
||||||
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
|
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
|
||||||
|
|
||||||
|
@ -7,5 +7,6 @@ services:
|
|||||||
- "27015:27015/tcp"
|
- "27015:27015/tcp"
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/factorio:/factorio
|
- /opt/factorio:/factorio
|
||||||
# user: 845:845
|
# environment:
|
||||||
# user: 1000:1000
|
# - PUID=1000
|
||||||
|
# - PGID=1000
|
||||||
|
@ -1,66 +1,71 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
FACTORIO_VOL=/factorio
|
FACTORIO_VOL=/factorio
|
||||||
mkdir -p $FACTORIO_VOL
|
mkdir -p "$FACTORIO_VOL"
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $MODS
|
mkdir -p "$MODS"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$SCENARIOS"
|
||||||
mkdir -p $SCRIPTOUTPUT
|
mkdir -p "$SCRIPTOUTPUT"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||||
# Generate a new RCON password if none exists
|
# Generate a new RCON password if none exists
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1 >"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
# Copy default settings if server-settings.json doesn't exist
|
# Copy default settings if server-settings.json doesn't exist
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l )
|
||||||
|
if [ "$NRTMPSAVES" -gt 0 ]; then
|
||||||
# Delete incomplete saves (such as after a forced exit)
|
# Delete incomplete saves (such as after a forced exit)
|
||||||
rm -f $SAVES/*.tmp.zip
|
rm -f "$SAVES"/*.tmp.zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" = '0' ]; then
|
if [ "$(id -u)" = '0' ]; then
|
||||||
|
# Update the User and Group ID based on the PUID/PGID variables
|
||||||
|
usermod -o -u "$PUID" factorio
|
||||||
|
groupmod -o -g "$PGID" factorio
|
||||||
# Take ownership of factorio data if running as root
|
# Take ownership of factorio data if running as root
|
||||||
chown -R factorio:factorio $FACTORIO_VOL
|
chown -R factorio:factorio "$FACTORIO_VOL"
|
||||||
# Make sure we own temp
|
|
||||||
#mkdir -p /opt/factorio/temp
|
|
||||||
#chown -R factorio:factorio /opt/factorio/temp
|
|
||||||
# Drop to the factorio user
|
# Drop to the factorio user
|
||||||
SU_EXEC="su-exec factorio"
|
SU_EXEC="su-exec factorio"
|
||||||
|
else
|
||||||
|
SU_EXEC=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
NRSAVES=$( find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l )
|
||||||
|
if [ "$NRSAVES" -eq 0 ]; then
|
||||||
# Generate a new map if no save ZIPs exist
|
# Generate a new map if no save ZIPs exist
|
||||||
${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
$SU_EXEC /opt/factorio/bin/x64/factorio \
|
||||||
--create $SAVES/_autosave1.zip \
|
--create "$SAVES/_autosave1.zip" \
|
||||||
--map-gen-settings $CONFIG/map-gen-settings.json \
|
--map-gen-settings "$CONFIG/map-gen-settings.json" \
|
||||||
--map-settings $CONFIG/map-settings.json
|
--map-settings "$CONFIG/map-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SU_EXEC} /opt/factorio/bin/x64/factorio \
|
# shellcheck disable=SC2086
|
||||||
--port $PORT \
|
exec $SU_EXEC /opt/factorio/bin/x64/factorio \
|
||||||
|
--port "$PORT" \
|
||||||
--start-server-load-latest \
|
--start-server-load-latest \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist "$CONFIG/server-banlist.json" \
|
||||||
--rcon-port $RCON_PORT \
|
--rcon-port "$RCON_PORT" \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||||
--use-server-whitelist \
|
--use-server-whitelist \
|
||||||
--server-adminlist $CONFIG/server-adminlist.json \
|
--server-adminlist "$CONFIG/server-adminlist.json" \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||||
--server-id /factorio/config/server-id.json \
|
--server-id /factorio/config/server-id.json \
|
||||||
"$@"
|
"$@"
|
||||||
|
@ -1,44 +1,42 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
echo "No argument supplied"
|
||||||
echo "No argument supplied"
|
|
||||||
fi
|
fi
|
||||||
SCENARIO=$1
|
SERVER_SCENARIO="$1"
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $MODS
|
mkdir -p "$MODS"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$SCENARIOS"
|
||||||
|
|
||||||
#chown -R factorio /factorio
|
#chown -R factorio /factorio
|
||||||
|
|
||||||
if [ ! -f $CONFIG/rconpw ]; then
|
if [ ! -f "$CONFIG/rconpw" ]; then
|
||||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
pwgen 15 1 >"$CONFIG/rconpw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
||||||
|
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--port $PORT \
|
--port "$PORT" \
|
||||||
--start-server-load-scenario $SCENARIO \
|
--start-server-load-scenario "$SERVER_SCENARIO" \
|
||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings "$CONFIG/server-settings.json" \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist "$CONFIG/server-banlist.json" \
|
||||||
--rcon-port $RCON_PORT \
|
--rcon-port "$RCON_PORT" \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat "$CONFIG/rconpw")" \
|
||||||
--server-id /factorio/config/server-id.json
|
--server-id /factorio/config/server-id.json
|
||||||
|
@ -1,30 +1,29 @@
|
|||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]; then
|
||||||
then
|
echo "No argument supplied"
|
||||||
echo "No argument supplied"
|
|
||||||
fi
|
fi
|
||||||
SCENARIO=$1
|
SERVER_SCENARIO="$1"
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
id
|
id
|
||||||
|
|
||||||
mkdir -p $SAVES
|
mkdir -p "$SAVES"
|
||||||
mkdir -p $CONFIG
|
mkdir -p "$CONFIG"
|
||||||
mkdir -p $MODS
|
mkdir -p "$MODS"
|
||||||
mkdir -p $SCENARIOS
|
mkdir -p "$SCENARIOS"
|
||||||
|
|
||||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $CONFIG/map-settings.json ]; then
|
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
|
||||||
|
|
||||||
exec /opt/factorio/bin/x64/factorio \
|
exec /opt/factorio/bin/x64/factorio \
|
||||||
--scenario2map $SCENARIO
|
--scenario2map "$SERVER_SCENARIO"
|
||||||
|
46
README.md
46
README.md
@ -1,10 +1,9 @@
|
|||||||
# 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://travis-ci.org/factoriotools/factorio-docker) [](https://microbadger.com/images/factoriotools/factorio) [](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/)
|
||||||
|
|
||||||
* `0.17.19`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile)
|
* `0.17.50`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/factoriotools/factorio-docker/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.16.51`, `0.16`, `stable` [(0.16/Dockerfile)](https://github.com/factoriotools/factorio-docker/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.15.40`, `0.15` [(0.15/Dockerfile)](https://github.com/factoriotools/factorio-docker/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/factoriotools/factorio-docker/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)
|
|
||||||
|
|
||||||
*Tag descriptions*
|
*Tag descriptions*
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ sudo docker run -d \
|
|||||||
-v /opt/factorio:/factorio \
|
-v /opt/factorio:/factorio \
|
||||||
--name factorio \
|
--name factorio \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
dtandersen/factorio
|
factoriotools/factorio
|
||||||
```
|
```
|
||||||
|
|
||||||
For those new to Docker, here is an explanation of the options:
|
For those new to Docker, here is an explanation of the options:
|
||||||
@ -81,7 +80,7 @@ To issue console commands to the server, start the server in interactive mode wi
|
|||||||
|
|
||||||
docker run -d -it \
|
docker run -d -it \
|
||||||
--name factorio \
|
--name factorio \
|
||||||
dtandersen/factorio
|
factoriotools/factorio
|
||||||
docker attach factorio
|
docker attach factorio
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ Delete the container and refresh the image:
|
|||||||
|
|
||||||
docker stop factorio
|
docker stop factorio
|
||||||
docker rm factorio
|
docker rm factorio
|
||||||
docker pull dtandersen/factorio
|
docker pull factoriotools/factorio
|
||||||
|
|
||||||
Now run the server as before. In about a minute the new version of Factorio should be up and running, complete with saves and config!
|
Now run the server as before. In about a minute the new version of Factorio should be up and running, complete with saves and config!
|
||||||
|
|
||||||
@ -126,13 +125,13 @@ docker run -d \
|
|||||||
--name factorio \
|
--name factorio \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
--entrypoint "/scenario.sh" \
|
--entrypoint "/scenario.sh" \
|
||||||
dtandersen/factorio \
|
factoriotools/factorio \
|
||||||
MyScenarioName
|
MyScenarioName
|
||||||
```
|
```
|
||||||
|
|
||||||
## Converting Scenarios to Regular Maps
|
## 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.
|
If you would like to export your scenario to a saved map, you can use the example entrypoint similar to the Scenario usage 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 \
|
docker run -d \
|
||||||
@ -142,7 +141,7 @@ docker run -d \
|
|||||||
--name factorio \
|
--name factorio \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
--entrypoint "/scenario2map.sh" \
|
--entrypoint "/scenario2map.sh" \
|
||||||
dtandersen/factorio
|
factoriotools/factorio
|
||||||
MyScenarioName
|
MyScenarioName
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ Example which replaces the server-settings.json:
|
|||||||
|
|
||||||
|
|
||||||
factorio_1:
|
factorio_1:
|
||||||
image: dtanders/factorio
|
image: factoriotools/factorio
|
||||||
ports:
|
ports:
|
||||||
- "34197:34197/udp"
|
- "34197:34197/udp"
|
||||||
volumes:
|
volumes:
|
||||||
@ -240,11 +239,11 @@ The files in this volume should be owned by the factorio user, uid 845.
|
|||||||
|
|
||||||
[Docker Compose](https://docs.docker.com/compose/install/) is an easy way to run Docker containers.
|
[Docker Compose](https://docs.docker.com/compose/install/) is an easy way to run Docker containers.
|
||||||
|
|
||||||
First get a [docker-compose.yml](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/docker-compose.yml) file. To get it from this repository:
|
First get a [docker-compose.yml](https://github.com/factoriotools/factorio-docker/blob/master/0.17/docker-compose.yml) file. To get it from this repository:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/dtandersen/docker_factorio_server.git
|
git clone https://github.com/factoriotools/factorio-docker.git
|
||||||
cd docker_factorio_server/0.16
|
cd docker_factorio_server/0.17
|
||||||
```
|
```
|
||||||
|
|
||||||
Or make your own:
|
Or make your own:
|
||||||
@ -253,7 +252,7 @@ Or make your own:
|
|||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
factorio:
|
factorio:
|
||||||
image: dtandersen/factorio
|
image: factoriotools/factorio
|
||||||
ports:
|
ports:
|
||||||
- "34197:34197/udp"
|
- "34197:34197/udp"
|
||||||
- "27015:27015/tcp"
|
- "27015:27015/tcp"
|
||||||
@ -278,8 +277,8 @@ sudo docker-compose up -d
|
|||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
* `PORT` (0.15+) - Start the server on an alterate port, .e.g. `docker run -e "PORT=34198"`.
|
* `PORT` (0.15+) - Start the server on an alternate port, .e.g. `docker run -e "PORT=34198"`.
|
||||||
* `RCON_PORT` (0.16+) - Start the RCON on an alterate port, .e.g. `docker run -e "RCON_PORT=34198"`.
|
* `RCON_PORT` (0.16+) - Start the RCON on an alternate port, .e.g. `docker run -e "RCON_PORT=34198"`.
|
||||||
|
|
||||||
|
|
||||||
## LAN Games
|
## LAN Games
|
||||||
@ -304,7 +303,7 @@ sudo docker run -d \
|
|||||||
-v /opt/factorio:/factorio \
|
-v /opt/factorio:/factorio \
|
||||||
--name factorio \
|
--name factorio \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
dtandersen/factorio
|
factoriotools/factorio
|
||||||
```
|
```
|
||||||
|
|
||||||
## Vagrant
|
## Vagrant
|
||||||
@ -318,6 +317,10 @@ For LAN games the VM needs an internal IP in order for clients to connect. One w
|
|||||||
config.vm.network "forwarded_port", guest: 34197, host: 34197
|
config.vm.network "forwarded_port", guest: 34197, host: 34197
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Amazon Web Services (AWS) Deployment
|
||||||
|
|
||||||
|
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Factorio Server Deployment (CloudFormation) repository](https://github.com/m-chandler/factorio-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
**My server is listed in the server browser, but nobody can connect**
|
**My server is listed in the server browser, but nobody can connect**
|
||||||
@ -335,8 +338,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) - Maintainer
|
||||||
* [Fank](https://github.com/Fankserver/docker-factorio-watchdog) - Keeper of the Factorio watchdog that keeps the version up-to-date.
|
* [Fank](https://github.com/Fankserver/docker-factorio-watchdog) - Keeper of the Factorio watchdog that keeps the version up-to-date.
|
||||||
|
* [SuperSandro2000](https://github.com/supersandro2000) - CI Guy
|
||||||
* [DBendit](https://github.com/DBendit/docker_factorio_server) - Admin list, ban list, version updates
|
* [DBendit](https://github.com/DBendit/docker_factorio_server) - Admin list, ban list, version updates
|
||||||
* [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
|
||||||
|
59
build.sh
Executable file
59
build.sh
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eox pipefail
|
||||||
|
|
||||||
|
if [ -z "$1" ] && [ -n "$CI" ]; then
|
||||||
|
echo "Usage: ./build.sh \$VERSION_SHORT"
|
||||||
|
exit 1
|
||||||
|
elif [ "$CI" == "true" ]; then
|
||||||
|
VERSION_SHORT="$1"
|
||||||
|
else
|
||||||
|
VERSION_SHORT=$(find . -maxdepth 1 -type d | sort | tail -1 | grep -o "[0-9].[0-9]*")
|
||||||
|
EXTRA_TAG=latest
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$VERSION_SHORT" || exit
|
||||||
|
|
||||||
|
VERSION=$(grep -oP '[0-9]+\.[0-9]+\.[0-9]+' Dockerfile | head -1)
|
||||||
|
DOCKER_REPO=factoriotools/factorio
|
||||||
|
|
||||||
|
if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
|
||||||
|
TAGS="$DOCKER_REPO:$TRAVIS_PULL_REQUEST_SLUG"
|
||||||
|
else
|
||||||
|
if [ "$TRAVIS_BRANCH" == "master" ] || [ "$TRAVIS_BRANCH" == "$VERSION" ]; then
|
||||||
|
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
|
||||||
|
elif [ -n "$TRAVIS_BRANCH" ]; then
|
||||||
|
TAGS="$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||||
|
elif [ "$CI" == "" ]; then
|
||||||
|
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$EXTRA_TAG" ]; then
|
||||||
|
TAGS="$TAGS -t $DOCKER_REPO:$EXTRA_TAG"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
docker build . -t $TAGS
|
||||||
|
docker images
|
||||||
|
|
||||||
|
if [[ "$(dirname "$(git diff --name-only HEAD^)")" =~ $VERSION_SHORT ]] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ] ||
|
||||||
|
[ "$TRAVIS_BRANCH" == "$VERSION" ] && [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ] ||
|
||||||
|
[ "$CI" == "" ]; then
|
||||||
|
|
||||||
|
if [ "$CI" == "true" ]; then
|
||||||
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BRANCH" != "$VERSION" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
|
||||||
|
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||||
|
fi
|
||||||
|
if [ -n "$TRAVIS_TAG" ] || [ "$CI" == "" ]; then
|
||||||
|
docker push "$DOCKER_REPO:$VERSION"
|
||||||
|
docker push "$DOCKER_REPO:$VERSION_SHORT"
|
||||||
|
fi
|
||||||
|
if [ -n "$EXTRA_TAG" ]; then
|
||||||
|
docker push "$DOCKER_REPO:$EXTRA_TAG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -X POST https://hooks.microbadger.com/images/factoriotools/factorio/TmmKGNp8jKcFqZvcJhTCIAJVluw=
|
||||||
|
fi
|
Reference in New Issue
Block a user