Compare commits

...

30 Commits

Author SHA1 Message Date
18ccac666d update to 0.17.40 2019-05-16 15:59:12 +00:00
830d042e4b Add me (SuperSandro2000) to the Contributors list 2019-05-15 20:05:36 +02:00
a0868ba653 Added build status & latest dockerhub version 2019-05-15 13:26:00 +02:00
7002778ab5 Updated urls 2019-05-15 13:07:30 +02:00
44371283b6 update to 0.17.39 2019-05-14 15:49:11 +00:00
d421adab67 update to 0.17.38 2019-05-10 14:39:11 +00:00
b0cedbbe1b Update docker-entrypoint.sh (#253) 2019-05-10 01:27:25 +02:00
010b96e0b0 update to 0.17.37 2019-05-07 16:29:12 +00:00
621ccf4282 Fixed naming of $SCENARIOS (#242)
Fixed naming of `$SCENARIOS`
2019-05-04 16:18:06 +02:00
1204b97fca update to 0.17.36 2019-05-03 16:29:13 +00:00
aef16e83a7 Fixed naming of $SCENARIOS
Renamed local variable `$SCENARIO` to `$SERVER_SCENARIO`
2019-05-02 12:07:38 -04:00
605ca74c0e Add travis ci, linter, merge shellcheck, fix some issues (#241)
* Quote all vars, remove useless echo/sub-shell, add shebands, fail on unset vars, enable pipefail, formatting

* Add CI including linting via hadolint nad shellcheck

* Update all base images to tag 3.9

* Switch to maintainer labels

* Quote vars

* Remove commented code

* Ignore if the folder exists
2019-05-02 17:28:20 +02:00
e34180ca51 update to 0.17.35 2019-05-02 14:34:11 +00:00
0db1dde077 Updated readme with new dockerhub links & updated version to 0.17 2019-05-02 13:10:51 +02:00
e8aeb461a9 Quote all vars, remove useless echo/sub-shell, add shebands, formatting (#226) 2019-05-02 14:53:26 +10:00
46f24b0b7a Quote all vars, remove useless echo/sub-shell, add shebands, fail on unset vars, enable pipefail, formatting 2019-05-01 10:04:56 +02:00
6d92825f56 Add AWS deployment repo Link (#235) 2019-04-29 08:23:24 +10:00
55fdc2e0de Remove reference to 0.13 path, fix spelling issues (#238) 2019-04-28 12:07:29 +02:00
57c9f59f46 Add AWS deployment repo Link. 2019-04-28 11:05:44 +10:00
8f15b73d7b update to 0.17.34 2019-04-26 15:04:11 +00:00
ecc54400ba update to 0.17.33 2019-04-24 17:19:11 +00:00
eea1d550f2 Fix conflicting user group ids (#232) 2019-04-21 12:15:01 +02:00
730b2c334b update to 0.17.32 2019-04-18 11:29:11 +00:00
288f080ebc Add support for changing UID/GID (#216)
* Add support for changing UID/GID

* Revert volume definition in docker-compose file
2019-04-18 13:00:14 +02:00
2ffac3c4a8 update to 0.17.31 2019-04-12 22:14:12 +00:00
88fed15bb4 update to 0.17.30 2019-04-12 17:09:11 +00:00
968fb8a3bd update to 0.17.29 2019-04-12 12:29:11 +00:00
9d642d8fb0 update to 0.17.28 2019-04-09 19:14:11 +00:00
4c3818b27c update to 0.17.26 2019-04-08 18:34:12 +00:00
a6d480d695 update to 0.17.25 2019-04-04 19:04:12 +00:00
21 changed files with 284 additions and 212 deletions

14
.hadolint.yaml Normal file
View 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

35
.travis.yml Normal file
View File

@ -0,0 +1,35 @@
dist: xenial
sudo: required
language: bash
services:
- docker
addons:
apt:
packages:
- jq
jobs:
include:
- stage: test
env: HADOLINT=${HOME}/hadolint
install: curl -sLo ${HADOLINT} $(curl -s https://api.github.com/repos/hadolint/hadolint/releases/latest?access_token=${GITHUB_TOKEN} | jq -r '.assets | .[] | select(.name=="hadolint-Linux-x86_64") | .browser_download_url')
&& chmod 700 ${HADOLINT}
script:
- git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 ${HADOLINT}
- bash -c 'shopt -s globstar; shellcheck **/*.sh'
- &build
stage: build
env: VERSION=0.17
script:
- ./build.sh $VERSION
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "$DOCKER_PASSWORD" | DOCKER login -u "$DOCKER_USERNAME" --password-stdin
docker push "factoriotools/docker_factorio_server:$VERSION"
fi
- <<: *build
env: VERSION=0.16
- <<: *build
env: VERSION=0.15
- <<: *build
env: VERSION=0.14

View File

@ -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 && \

View File

@ -1 +1,2 @@
#!/bin/sh
sudo docker build --no-cache -t factorio . sudo docker build --no-cache -t factorio .

View File

@ -1 +1,2 @@
#!/bin/sh
sudo rm -rf /tmp/factorio sudo rm -rf /tmp/factorio

View File

@ -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")"

View File

@ -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 \

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -1,48 +1,48 @@
#!/bin/sh -x #!/bin/sh -x
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"
mkdir -p $SCRIPTOUTPUT 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 ! 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 \
$@ "$@"

View File

@ -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

View File

@ -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"

View File

@ -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,16 +9,18 @@ ARG PGID=845
ENV PORT=34197 \ ENV PORT=34197 \
RCON_PORT=27015 \ RCON_PORT=27015 \
VERSION=0.17.24 \ VERSION=0.17.40 \
SHA1=2e1229b0b2d7dc632607753194a952c29ca42217 \ SHA1=56bdcb95dbc6d426a51ea2fdd2ff63789a641db7 \
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 && \

View File

@ -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

View File

@ -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 \
"$@" "$@"

View File

@ -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

View File

@ -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"

View File

@ -1,10 +1,9 @@
# Factorio [![](https://images.microbadger.com/badges/image/dtandersen/factorio.svg)](https://microbadger.com/images/dtandersen/factorio "Get your own image badge on microbadger.com") [![Docker Pulls](https://img.shields.io/docker/pulls/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/dtandersen/factorio.svg)](https://hub.docker.com/r/dtandersen/factorio/) # Factorio [![Build Status](https://travis-ci.org/factoriotools/factorio-docker.svg?branch=master)](https://travis-ci.org/factoriotools/factorio-docker) [![](https://images.microbadger.com/badges/version/factoriotools/factorio.svg)](https://microbadger.com/images/factoriotools/factorio) [![](https://images.microbadger.com/badges/image/factoriotools/factorio.svg)](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") [![Docker Pulls](https://img.shields.io/docker/pulls/factoriotools/factorio.svg)](https://hub.docker.com/r/factoriotools/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/factoriotools/factorio.svg)](https://hub.docker.com/r/factoriotools/factorio/)
* `0.17.24`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.17/Dockerfile) * `0.17.40`, `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

12
build.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eo pipefail
if [ -z "$1" ] ; then
echo "Usage: ./build.sh \$VERSION"
else
VERSION="$1"
fi
cd "$VERSION" || exit
docker build . -t "factoriotools/docker_factorio_server:$VERSION"

2
lint.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 ./hadolint