Compare commits

...

137 Commits

Author SHA1 Message Date
4e4810aea3 Combine stages for faster pipeline 2019-11-20 22:57:13 +01:00
d667a247e1 Fix typo 2019-11-20 22:53:23 +01:00
ce1f980525 Make 0.17.79 stable
Closes #295
2019-11-20 22:47:20 +01:00
120ee1bbdb Update to Factorio 0.17.79 2019-11-19 18:43:06 +00:00
5cba3991ef Fix stable version in readme 2019-11-19 15:55:10 +01:00
412c16e379 Update to Factorio 0.17.79 2019-11-19 14:32:54 +00:00
82635a9cff Update to Factorio 0.17.78 2019-11-15 17:48:02 +00:00
c495fc38a4 Update to Factorio 0.17.77 2019-11-14 20:10:02 +00:00
b580447de4 Update Docker Hub Description 2019-11-11 22:21:45 +01:00
2290034ecf Update to Factorio 0.17.76 2019-11-10 02:29:36 +01:00
300300e7ec Fix stable tag 2019-11-07 00:27:02 +01:00
179be082d9 Update to Factorio 0.17.75 2019-11-07 00:22:42 +01:00
efcc29cfed Mod Updater: Force remove mod archives
Closes #293
2019-11-04 16:12:49 +01:00
1b7decd8ce Mark 0.17 stable 2019-11-01 10:15:23 +01:00
b38750e4ac Update to Factorio 0.17.74 2019-10-25 15:17:09 +00:00
bfb8b7fd95 Update to Factorio 0.17.73 2019-10-24 18:30:51 +00:00
8b5d4e06df Update to Factorio 0.17.72 2019-10-18 13:08:58 +00:00
33060cc4fb Update readme 2019-10-18 11:56:15 +02:00
e1beb32f81 Fix CI 2019-10-18 11:56:07 +02:00
2c1d1cd985 Fix CI
hopefully!
2019-10-18 11:52:25 +02:00
39fd391e9b Fix ci script for manual runs 2019-10-18 11:37:43 +02:00
a5d6466f0b Fix variable expansion 2019-10-18 11:21:15 +02:00
c6b15d89c1 Fix shellcheck 2019-10-18 11:15:36 +02:00
7c9011dcee Add note for when 0.17 leaves experimental entirely 2019-10-18 10:53:16 +02:00
b5af3130e2 Format 2019-10-18 10:51:06 +02:00
e307b1d537 CI: Add support for comma seperated extra tags 2019-10-18 10:50:25 +02:00
8c0ddf99ce Update to Factorio 0.17.71 2019-10-16 16:06:48 +00:00
d7b79c567a Update to Factorio 0.17.70 2019-10-15 20:20:03 +00:00
3e62698b4b Update store links 2019-10-01 16:25:31 +02:00
d4870219f6 Added a link to Gog in addition to Factorio's website and Steam in the README.md (#290) 2019-10-01 11:48:30 +02:00
01194242b9 Update to Factorio 0.17.69 2019-09-19 15:32:52 +00:00
4255475b18 Update to Factorio 0.17.68 2019-09-04 17:49:55 +00:00
4ff8179912 Update to Factorio 0.17.67 2019-09-03 12:49:54 +00:00
db14988396 update to 0.17.66 2019-08-16 13:40:26 +00:00
cd29f2003b Load admin list in scenario (#288) 2019-08-16 13:58:59 +02:00
cd2d89a7bc update to 0.17.65 2019-08-14 11:35:26 +00:00
2d9f646728 Fix whitelist args in scenario entrypoint 2019-08-11 01:40:33 +02:00
9e96ca5aa8 update to 0.17.64 2019-08-09 19:24:45 +00:00
5c947846d1 Fix 0.17.63 SHA (#284) 2019-08-07 13:57:43 +02:00
edd0c95d9b update to 0.17.63 2019-08-06 12:20:39 +00:00
6651289d6e update to 0.17.62 2019-08-02 22:37:32 +00:00
784626b689 update to 0.17.61 2019-08-02 17:07:36 +00:00
47ce1706db update to 0.17.60 2019-07-30 14:37:31 +00:00
460ba0187d Update to 0.17.59 (#281)
* Update Dockerfile

* Update README.md
2019-07-26 00:28:10 +02:00
6d496def35 update to 0.17.58 2019-07-15 21:28:01 +00:00
9f8f6da0d2 update to 0.17.57 2019-07-15 17:43:15 +00:00
71c75671d5 Add debug code when sha match fails 2019-07-13 12:23:01 +02:00
5a66d1a8df Revert "Fix 0.17.56 sha"
This reverts commit a48b9d107d.
2019-07-13 12:22:21 +02:00
a48b9d107d Fix 0.17.56 sha 2019-07-13 12:05:08 +02:00
e5f34134f7 Apply shell-format 2019-07-13 12:04:34 +02:00
5d997bf1c7 update to 0.17.56 2019-07-11 20:13:01 +00:00
7a08cbb04c update to 0.17.55 2019-07-09 13:33:01 +00:00
40cc26ca02 URL encode spaces (#276)
Closes #275
2019-07-08 17:05:18 +02:00
e8705a44b8 Fix docker push with new incremental tags pt. 3 2019-07-06 17:32:35 +02:00
fe9875343f Fix docker push with new incremental tags pt. 2 2019-07-06 17:26:15 +02:00
06729a6097 Fix docker push with new incremental tags 2019-07-06 17:21:08 +02:00
95766e90c9 Switch to test pt. 2 2019-07-06 17:00:03 +02:00
4afbed52c8 Switch to test, add support for incremental tags
Closes #274
2019-07-06 16:46:56 +02:00
fd7b8cd839 Made username, token checking more robust against configuration errors 2019-07-06 16:45:38 +02:00
9c92ac9342 Fix sha check 2019-07-06 16:41:40 +02:00
1b6c8adf28 Switch to test, cleanupm, formatting 2019-07-06 16:37:13 +02:00
65c5833fd9 Cleanup shebangs, add set -eou[x] pipefail to all files 2019-07-06 16:32:49 +02:00
c949351391 Update readme to reflect upcoming tagging change. 2019-07-06 14:23:35 +02:00
6ae5795d38 Hide apk progress, sort packages 2019-07-05 09:24:04 +02:00
29ee60236e Switch scripts to bash
Closes #268, #269
2019-07-05 09:19:46 +02:00
7028eb72f6 Add @carlbennett as a contributor 2019-07-05 09:11:12 +02:00
dfeb95d614 Update to 0.17.54 (#271) 2019-07-05 02:46:55 +02:00
f8c62978ee Add executable permission on 0.17 shell files (#270) 2019-07-05 02:46:24 +02:00
28598a42a3 Rebase modupdater (#267)
Based on work from https://github.com/ALovedOne and https://github.com/patschi
2019-07-04 00:34:09 +02:00
4ba56ee010 Link version badge to Docker Hub, organize badges 2019-07-03 11:33:02 +02:00
d2a02e8a66 Update contributors description 2019-07-02 23:02:15 +02:00
5b24f8ac74 update to 0.17.53 2019-07-02 20:18:40 +00:00
e3466a9800 Update to 0.17.52 (#266) 2019-06-25 16:42:09 +02:00
e6f66a2100 update to 0.17.51 2019-06-25 16:40:18 +02:00
18153f3f46 update to 0.17.50 2019-06-17 15:39:11 +00:00
62e1a9f266 update to 0.17.49 2019-06-13 17:09:11 +00:00
be7ecddb0d update to 0.17.48 2019-06-11 14:14:13 +00:00
43599d0c23 update to 0.17.47 2019-06-07 15:49:12 +00:00
6fb4cbc600 update to 0.17.46 2019-06-07 11:19:11 +00:00
fe0e8f9b91 update to 0.17.45 2019-05-31 13:14:12 +00:00
f76e88cea1 update to 0.17.44 2019-05-30 15:14:11 +00:00
cbaa20cdea CI: Do not try to push master 2019-05-25 23:49:55 +02:00
b3c134d396 update to 0.17.43 2019-05-24 13:09:12 +00:00
9bdb79b494 CI: Do not try to push master 2019-05-21 22:37:26 +02:00
77d83b4152 update to 0.17.42 2019-05-21 17:09:12 +00:00
25d4edf14f CI: Don't push $TRAVIS_BRANCH if it is equal to $VERSIOn
Reason behind that is that git tags have $TRAVIS_BRANCH set to the tag name
2019-05-18 14:07:27 +02:00
e16b111c0b CI: Tag Docker Image with $VERSION_SHORT on git tag building 2019-05-18 14:01:22 +02:00
09e1ad2045 CI: another try to fix tag building 2019-05-18 13:40:25 +02:00
2efa39084f Cache shields.io badges for 10m 2019-05-18 13:37:51 +02:00
77edb05109 CI: try fix tag building, fix upload, add easy manual pushing, more fixes 2019-05-18 13:26:04 +02:00
2eea2a25e4 CI: correct docker hub repo name 2019-05-17 19:57:33 +02:00
98ea8a27c1 Fix sha1 of 0.17.41
Closes #261
2019-05-17 19:45:29 +02:00
956af65a2b update to 0.17.41 2019-05-17 11:19:10 +00:00
b5c1dff7b4 Allow puid/pgid to be set as environment vars on stable (#256)
* allow puid/pgid to be set on stable

* update docker-entrypoint to include puid, gpid

* add quotes to env puid/pgid env vars

* add quotes for factorio-vol
2019-05-17 12:32:55 +02:00
ee5b023911 Quote all vars in Dockerfile (#259) 2019-05-17 09:11:09 +02:00
045ef7a214 Skip docker push if it is a PR 2019-05-16 20:19:36 +02:00
bbc2d42302 Compare $VERSION_SHORT wether we need to push the image 2019-05-16 20:04:24 +02:00
0173eab54c Quote factorio volume variable 2019-05-16 19:59:42 +02:00
f868aa16ad Follow up to #255 2019-05-16 19:55:43 +02:00
5cd0c40975 fix for .tmp.zip saves not being deleted on start (#255)
Co-Authored-By: Chris Cowan <agentme49@gmail.com>
2019-05-16 19:55:02 +02:00
778d982c6d CI: Actually check the entire array 2019-05-16 19:43:44 +02:00
9d2c38df65 CI: Fix version detection of which image to push, actually push the image 2019-05-16 19:39:50 +02:00
b2a4195e13 Advance CI features (#245)
* Build feature branches with branch tag

* Build short and long image tag

* Add latest and stable tag, made moving repos easier

* Only push tags to registry

* Only build tags that where changed

* Fix if and quoting, push $VERSION_SHORT

* Update MicroBadger with Webhook, closes #251

* Quote vars

* Set tag on PR, too

* Switch to hadolint docker image

due to PR not having enviroment variables and I don't want to commit my token in the script

* Only push image on master
2019-05-16 19:23:07 +02:00
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
fce556160a update to 0.17.24 2019-04-02 17:39:13 +00:00
4727f62a8f update to 0.17.23 2019-03-29 16:58:35 +00:00
64cbf48082 update to 0.17.22 2019-03-29 12:43:35 +00:00
dd6bc76827 update to 0.17.21 2019-03-26 20:48:35 +00:00
23 changed files with 590 additions and 295 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

31
.travis.yml Normal file
View File

@ -0,0 +1,31 @@
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 & update Docker HUB description
env: VERSION_SHORT=0.17 EXTRA_TAG=latest STABLE=0.17.79
script:
- ./build.sh $VERSION_SHORT
- <<: *build
env: VERSION_SHORT=0.16
- <<: *build
env: VERSION_SHORT=0.15
- <<: *build
env: VERSION_SHORT=0.14
- if: branch = master
script: docker run -v $PWD:/workspace -e DOCKERHUB_USERNAME=$DOCKER_USERNAME -e DOCKERHUB_PASSWORD=$DOCKER_PASSWORD -e DOCKERHUB_REPOSITORY='factoriotools/factorio' -e README_FILEPATH='/workspace/README.md' peterevans/dockerhub-description:2.1.0

View File

@ -1,20 +1,20 @@
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 \
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
RUN mkdir /opt && \
apk --no-cache add curl tini pwgen && \
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
apk del curl && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods
RUN mkdir -p /opt \
&& apk --no-cache add curl tini pwgen \
&& curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
-o /tmp/factorio_headless_x64_$VERSION.tar.gz \
&& echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c \
&& tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt \
&& rm /tmp/factorio_headless_x64_$VERSION.tar.gz \
&& apk del curl \
&& ln -s /factorio/saves /opt/factorio/saves \
&& ln -s /factorio/mods /opt/factorio/mods
VOLUME /factorio

View File

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

View File

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

View File

@ -1,35 +1,35 @@
#!/bin/sh -x
set -e
set -euo pipefail
SAVES=/factorio/saves
CONFIG=/factorio/config
mkdir -p $SAVES
mkdir -p "$SAVES"
mkdir -p /factorio/mods
mkdir -p $CONFIG
mkdir -p "$CONFIG"
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
pwgen 15 1 >"$CONFIG/rconpw"
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then
/opt/factorio/bin/x64/factorio \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json
--create "$SAVES/_autosave1.zip" \
--map-gen-settings "$CONFIG/map-gen-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--port 34197 \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--server-settings "$CONFIG/server-settings.json" \
--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 \
-v /tmp/factorio:/factorio \
--name factorio \

View File

@ -1,24 +1,24 @@
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 \
RCON_PORT=27015 \
VERSION=0.15.40 \
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
RUN mkdir /opt && \
apk add --update --no-cache tini pwgen && \
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 && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
chmod -R ugo=rwx /opt/factorio && \
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
ln -s /factorio/saves /opt/factorio/saves && \
ln -s /factorio/mods /opt/factorio/mods && \
apk del .build-deps
RUN mkdir -p /opt \
&& apk add --update --no-cache tini pwgen \
&& 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 \
&& echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c \
&& tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt \
&& chmod -R ugo=rwx /opt/factorio \
&& rm /tmp/factorio_headless_x64_$VERSION.tar.xz \
&& ln -s /factorio/saves /opt/factorio/saves \
&& ln -s /factorio/mods /opt/factorio/mods \
&& apk del .build-deps
VOLUME /factorio

View File

@ -1,43 +1,43 @@
#!/bin/sh -x
set -e
set -euo pipefail
SAVES=/factorio/saves
CONFIG=/factorio/config
mkdir -p $SAVES
mkdir -p "$SAVES"
mkdir -p /factorio/mods
mkdir -p $CONFIG
mkdir -p "$CONFIG"
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
if [ ! -f "$CONFIG/rconpw" ]; then
pwgen 15 1 >"$CONFIG/rconpw"
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [ ! -f "$CONFIG/map-settings.json" ]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
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 \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json \
--map-settings $CONFIG/map-settings.json
--create "$SAVES/_autosave1.zip" \
--map-gen-settings "$CONFIG/map-gen-settings.json" \
--map-settings "$CONFIG/map-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--port $PORT \
--port "$PORT" \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--server-whitelist $CONFIG/server-whitelist.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--rcon-password "$(cat $CONFIG/rconpw)" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--server-banlist "$CONFIG/server-banlist.json" \
--rcon-port "$RCON_PORT" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--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 GROUP=factorio
@ -15,25 +15,27 @@ ENV PORT=34197 \
CONFIG=/factorio/config \
MODS=/factorio/mods \
SCENARIOS=/factorio/scenarios \
SCRIPTOUTPUT=/factorio/script-output
SCRIPTOUTPUT=/factorio/script-output \
PUID="$PUID" \
PGID="$PGID"
RUN mkdir -p /opt /factorio && \
apk add --update --no-cache pwgen && \
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 && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
chmod ugo=rwx /opt/factorio && \
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
ln -s $SAVES /opt/factorio/saves && \
ln -s $MODS /opt/factorio/mods && \
ln -s $SCENARIOS /opt/factorio/scenarios && \
ln -s $SCRIPTOUTPUT /opt/factorio/script-output && \
apk del .build-deps && \
addgroup -g $PGID -S $GROUP && \
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
chown -R $USER:$GROUP /opt/factorio /factorio
RUN mkdir -p /opt /factorio \
&& apk add --update --no-cache pwgen su-exec shadow \
&& 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 \
&& echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c \
&& tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt \
&& chmod ugo=rwx /opt/factorio \
&& rm /tmp/factorio_headless_x64_$VERSION.tar.xz \
&& ln -s $SAVES /opt/factorio/saves \
&& ln -s $MODS /opt/factorio/mods \
&& ln -s $SCENARIOS /opt/factorio/scenarios \
&& ln -s $SCRIPTOUTPUT /opt/factorio/script-output \
&& apk del .build-deps \
&& addgroup -g $PGID -S $GROUP \
&& adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER \
&& chown -R $USER:$GROUP /opt/factorio /factorio
VOLUME /factorio
@ -41,6 +43,4 @@ EXPOSE $PORT/udp $RCON_PORT/tcp
COPY files/ /
USER $USER
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@ -1,48 +1,62 @@
#!/bin/sh -x
set -e
set -euo pipefail
id
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
mkdir -p $SCRIPTOUTPUT
FACTORIO_VOL=/factorio
mkdir -p "$FACTORIO_VOL"
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
mkdir -p "$SCRIPTOUTPUT"
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
if [ ! -f "$CONFIG/rconpw" ]; then
pwgen 15 1>"$CONFIG/rconpw"
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [ ! -f "$CONFIG/map-settings.json" ]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
rm -f $SAVES/*.tmp.zip
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
/opt/factorio/bin/x64/factorio \
--create $SAVES/_autosave1.zip \
--map-gen-settings $CONFIG/map-gen-settings.json \
--map-settings $CONFIG/map-settings.json
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
chown -R factorio:factorio "$FACTORIO_VOL"
# Drop to the factorio user
SU_EXEC="su-exec factorio"
else
SU_EXEC=""
fi
exec /opt/factorio/bin/x64/factorio \
--port $PORT \
if ! find -L "$SAVES" -iname \*.zip -mindepth 1 -print | grep -q .; then
$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 \
--server-settings $CONFIG/server-settings.json \
--server-whitelist $CONFIG/server-whitelist.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--rcon-password "$(cat $CONFIG/rconpw)" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--server-banlist "$CONFIG/server-banlist.json" \
--rcon-port "$RCON_PORT" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--server-id /factorio/config/server-id.json \
$@
"$@"

View File

@ -1,44 +1,42 @@
#!/bin/sh -x
if [ -z "$1" ]
then
echo "No argument supplied"
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO=$1
SERVER_SCENARIO=$1
set -e
set -euo pipefail
id
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
#chown -R factorio /factorio
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
if [ ! -f "$CONFIG/rconpw" ]; then
pwgen 15 1 >"$CONFIG/rconpw"
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [ ! -f "$CONFIG/map-settings.json" ]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--port $PORT \
--start-server-load-scenario $SCENARIO \
--server-settings $CONFIG/server-settings.json \
--server-whitelist $CONFIG/server-whitelist.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--rcon-password "$(cat $CONFIG/rconpw)" \
--port "$PORT" \
--start-server-load-scenario "$SERVER_SCENARIO" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--server-banlist "$CONFIG/server-banlist.json" \
--rcon-port "$RCON_PORT" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--server-id /factorio/config/server-id.json

View File

@ -1,30 +1,29 @@
#!/bin/sh -x
if [ -z "$1" ]
then
echo "No argument supplied"
if [ -z "$1" ]; then
echo "No argument supplied"
fi
SCENARIO=$1
SERVER_SCENARIO=$1
set -e
set -euo pipefail
id
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [ ! -f "$CONFIG/server-settings.json" ]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [ ! -f "$CONFIG/map-gen-settings.json" ]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [ ! -f "$CONFIG/map-settings.json" ]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--scenario2map $SCENARIO
--scenario2map "$SERVER_SCENARIO"

View File

@ -1,6 +1,6 @@
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 GROUP=factorio
@ -9,31 +9,33 @@ ARG PGID=845
ENV PORT=34197 \
RCON_PORT=27015 \
VERSION=0.17.20 \
SHA1=666b114d13f791eda3108bf099bad645426d608b \
VERSION=0.17.79 \
SHA1=7f127baf3cf01c6e545a9ca376dec1ac37468f8a \
SAVES=/factorio/saves \
CONFIG=/factorio/config \
MODS=/factorio/mods \
SCENARIOS=/factorio/scenarios \
SCRIPTOUTPUT=/factorio/script-output
SCRIPTOUTPUT=/factorio/script-output \
PUID="$PUID" \
PGID="$PGID"
RUN mkdir -p /opt /factorio && \
apk add --update --no-cache pwgen su-exec binutils gettext libintl && \
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 && \
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
chmod ugo=rwx /opt/factorio && \
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
ln -s $SAVES /opt/factorio/saves && \
ln -s $MODS /opt/factorio/mods && \
ln -s $SCENARIOS /opt/factorio/scenarios && \
ln -s $SCRIPTOUTPUT /opt/factorio/script-output && \
apk del .build-deps && \
addgroup -g $PGID -S $GROUP && \
adduser -u $PUID -G $GROUP -s /bin/sh -SDH $USER && \
chown -R $USER:$GROUP /opt/factorio /factorio
RUN set -ox pipefail \
&& archive="/tmp/factorio_headless_x64_$VERSION.tar.xz" \
&& mkdir -p /opt /factorio \
&& apk add --update --no-cache --no-progress bash binutils curl file gettext jq libintl pwgen shadow su-exec \
&& curl -sSL "https://www.factorio.com/get-download/$VERSION/headless/linux64" -o "$archive" \
&& echo "$SHA1 $archive" | sha1sum -c \
|| (sha1sum "$archive" && file "$archive" && exit 1) \
&& tar xf "$archive" --directory /opt \
&& chmod ugo=rwx /opt/factorio \
&& rm "$archive" \
&& ln -s "$SAVES" /opt/factorio/saves \
&& ln -s "$MODS" /opt/factorio/mods \
&& ln -s "$SCENARIOS" /opt/factorio/scenarios \
&& ln -s "$SCRIPTOUTPUT" /opt/factorio/script-output \
&& addgroup -g "$PGID" -S "$GROUP" \
&& adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" \
&& chown -R "$USER":"$GROUP" /opt/factorio /factorio
VOLUME /factorio

View File

@ -7,5 +7,9 @@ services:
- "27015:27015/tcp"
volumes:
- /opt/factorio:/factorio
# user: 845:845
# user: 1000:1000
# environment:
# - PUID=1000
# - PGID=1000
# - UPDATE_MODS_ON_START=true
# - USERNAME=FactorioUsername
# - TOKEN=FactorioToken

View File

@ -1,66 +1,73 @@
#!/bin/sh -x
set -e
id
#!/bin/bash
set -eoux pipefail
FACTORIO_VOL=/factorio
mkdir -p $FACTORIO_VOL
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
mkdir -p $SCRIPTOUTPUT
mkdir -p "$FACTORIO_VOL"
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
mkdir -p "$SCRIPTOUTPUT"
if [ ! -f $CONFIG/rconpw ]; then
if [[ ! -f $CONFIG/rconpw ]]; then
# Generate a new RCON password if none exists
echo $(pwgen 15 1) > $CONFIG/rconpw
pwgen 15 1 >"$CONFIG/rconpw"
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
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
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [[ ! -f $CONFIG/map-settings.json ]]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
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)
rm -f $SAVES/*.tmp.zip
rm -f "$SAVES"/*.tmp.zip
fi
if [ "$(id -u)" = '0' ]; then
if [[ ${UPDATE_MODS_ON_START:-} ]]; then
./docker-update-mods.sh
fi
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
chown -R factorio:factorio $FACTORIO_VOL
# Make sure we own temp
#mkdir -p /opt/factorio/temp
#chown -R factorio:factorio /opt/factorio/temp
chown -R factorio:factorio "$FACTORIO_VOL"
# Drop to the factorio user
SU_EXEC="su-exec factorio"
else
SU_EXEC=""
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
${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
$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 \
# shellcheck disable=SC2086
exec $SU_EXEC /opt/factorio/bin/x64/factorio \
--port "$PORT" \
--start-server-load-latest \
--server-settings $CONFIG/server-settings.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--server-whitelist $CONFIG/server-whitelist.json \
--server-settings "$CONFIG/server-settings.json" \
--server-banlist "$CONFIG/server-banlist.json" \
--rcon-port "$RCON_PORT" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--use-server-whitelist \
--server-adminlist $CONFIG/server-adminlist.json \
--rcon-password "$(cat $CONFIG/rconpw)" \
--server-adminlist "$CONFIG/server-adminlist.json" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--server-id /factorio/config/server-id.json \
"$@"

View File

@ -0,0 +1,28 @@
#!/bin/bash
set -eou pipefail
if [[ -f /run/secrets/username ]]; then
USERNAME=$(cat /run/secrets/username)
fi
if [[ -f /run/secrets/username ]]; then
TOKEN=$(cat /run/secrets/token)
fi
if [[ -z ${USERNAME:-} ]]; then
USERNAME="$(jq -j ".username" "$CONFIG/server-settings.json")"
fi
if [[ -z ${TOKEN:-} ]]; then
TOKEN="$(jq -j ".token" "$CONFIG/server-settings.json")"
fi
if [[ -z ${USERNAME:-} ]]; then
echo "You need to provide your Factorio username to update mods."
fi
if [[ -z ${TOKEN:-} ]]; then
echo "You need to provide your Factorio token to update mods."
fi
./update-mods.sh "$VERSION" "$MODS" "$USERNAME" "$TOKEN"

View File

@ -1,44 +1,42 @@
#!/bin/sh -x
if [ -z "$1" ]
then
echo "No argument supplied"
#!/bin/bash
set -eoux pipefail
if [[ -z ${1:-} ]]; then
echo "No argument supplied"
fi
SCENARIO=$1
set -e
id
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
SERVER_SCENARIO="$1"
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
#chown -R factorio /factorio
if [ ! -f $CONFIG/rconpw ]; then
echo $(pwgen 15 1) > $CONFIG/rconpw
if [[ ! -f $CONFIG/rconpw ]]; then
pwgen 15 1 >"$CONFIG/rconpw"
fi
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [[ ! -f $CONFIG/server-settings.json ]]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [[ ! -f $CONFIG/map-settings.json ]]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--port $PORT \
--start-server-load-scenario $SCENARIO \
--server-settings $CONFIG/server-settings.json \
--server-whitelist $CONFIG/server-whitelist.json \
--server-banlist $CONFIG/server-banlist.json \
--rcon-port $RCON_PORT \
--rcon-password "$(cat $CONFIG/rconpw)" \
--port "$PORT" \
--start-server-load-scenario "$SERVER_SCENARIO" \
--server-settings "$CONFIG/server-settings.json" \
--server-banlist "$CONFIG/server-banlist.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--use-server-whitelist \
--server-adminlist "$CONFIG/server-adminlist.json" \
--rcon-port "$RCON_PORT" \
--rcon-password "$(cat "$CONFIG/rconpw")" \
--server-id /factorio/config/server-id.json

View File

@ -1,30 +1,27 @@
#!/bin/sh -x
if [ -z "$1" ]
then
echo "No argument supplied"
fi
SCENARIO=$1
#!/bin/bash
set -eoux pipefail
set -e
id
mkdir -p $SAVES
mkdir -p $CONFIG
mkdir -p $MODS
mkdir -p $SCENARIOS
if [ ! -f $CONFIG/server-settings.json ]; then
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
if [[ -z ${1:-} ]]; then
echo "No argument supplied"
fi
if [ ! -f $CONFIG/map-gen-settings.json ]; then
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
SERVER_SCENARIO="$1"
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
mkdir -p "$SCENARIOS"
if [[ ! -f $CONFIG/server-settings.json ]]; then
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
fi
if [ ! -f $CONFIG/map-settings.json ]; then
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-settings.json
if [[ ! -f $CONFIG/map-gen-settings.json ]]; then
cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json"
fi
if [[ ! -f $CONFIG/map-settings.json ]]; then
cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json"
fi
exec /opt/factorio/bin/x64/factorio \
--scenario2map $SCENARIO
--scenario2map "$SERVER_SCENARIO"

94
0.17/files/update-mods.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
set -eou pipefail
FACTORIO_VERSION=$1
MOD_DIR=$2
USERNAME=$3
TOKEN=$4
MOD_BASE_URL="https://mods.factorio.com"
print_step()
{
echo "$1"
}
print_success()
{
echo "$1"
}
print_failure()
{
echo "$1"
}
update_mod()
{
MOD_NAME="${1// /%20}"
print_step "Checking for update of mod $MOD_NAME..."
MOD_INFO_URL="$MOD_BASE_URL/api/mods/$MOD_NAME"
MOD_INFO_JSON=$(curl --silent "$MOD_INFO_URL")
MOD_INFO=$(echo "$MOD_INFO_JSON" | jq -j --arg version "$FACTORIO_VERSION" ".releases|reverse|map(select(.info_json.factorio_version as \$mod_version | \$version | startswith(\$mod_version)))[0]|.file_name, \";\", .download_url, \";\", .sha1")
MOD_FILENAME=$(echo "$MOD_INFO" | cut -f1 -d";")
MOD_URL=$(echo "$MOD_INFO" | cut -f2 -d";")
MOD_SHA1=$(echo "$MOD_INFO" | cut -f3 -d";")
if [[ -z $MOD_URL ]]; then
return 1
fi
if [[ $MOD_FILENAME == null ]]; then
print_failure " Not compatible with version"
return 1
fi
if [[ -f $MOD_DIR/$MOD_FILENAME ]]; then
print_success " Already up-to-date."
return 0
fi
print_step "Downloading..."
FULL_URL="$MOD_BASE_URL$MOD_URL?username=$USERNAME&token=$TOKEN"
HTTP_STATUS=$(curl --silent -L -w "%{http_code}" -o "$MOD_DIR/$MOD_FILENAME" "$FULL_URL")
if [[ $HTTP_STATUS != 200 ]]; then
print_failure " Download failed: Code $HTTP_STATUS."
rm -f "$MOD_DIR/$MOD_FILENAME"
return 1
fi
if [[ ! -f $MOD_DIR/$MOD_FILENAME ]]; then
print_failure " Downloaded file missing!"
return 1
fi
if ! [[ $(sha1sum "$MOD_DIR/$MOD_FILENAME") =~ $MOD_SHA1 ]]; then
print_failure " SHA1 mismatch!"
rm -f "$MOD_DIR/$MOD_FILENAME"
return 1
fi
print_success " Download complete."
for file in "$MOD_DIR/${MOD_NAME}_"*".zip"; do # wildcard does usually not work in quotes: https://unix.stackexchange.com/a/67761
if [[ $file != $MOD_DIR/$MOD_FILENAME ]]; then
print_success " Deleting old version: $file"
rm -f "$file"
fi
done
return 0
}
if [[ -f $MOD_DIR/mod-list.json ]]; then
jq -r ".mods|map(select(.enabled))|.[].name" "$MOD_DIR/mod-list.json" | while read -r mod; do
if [[ $mod != base ]]; then
update_mod "$mod"
fi
done
fi

View File

@ -1,18 +1,17 @@
# 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) [![Docker Version](https://images.microbadger.com/badges/version/factoriotools/factorio.svg)](https://hub.docker.com/r/factoriotools/factorio/) [![Docker Pulls](https://img.shields.io/docker/pulls/factoriotools/factorio.svg?maxAge=600)](https://hub.docker.com/r/factoriotools/factorio/) [![Docker Stars](https://img.shields.io/docker/stars/factoriotools/factorio.svg?maxAge=600)](https://hub.docker.com/r/factoriotools/factorio/) [![Microbadger Layers](https://images.microbadger.com/badges/image/factoriotools/factorio.svg)](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com")
* `0.17.20`, `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)
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
* `0.17.79`, `0.17`, `latest`, `stable` [(0.17/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.17/Dockerfile)
* `0.16.51`, `0.16` [(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/factoriotools/factorio-docker/blob/master/0.15/Dockerfile)
* `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.14/Dockerfile)
*Tag descriptions*
* `latest` - most up-to-date version (may be experimental).
* `stable` - version declared stable on [factorio.com](https://www.factorio.com).
* `0.x` - latest version in a branch.
* `0.x` - latest version in a branch.
* `0.x.y` - a specific version.
* `0.x-dev` - whatever is in master for that version.
* `0.x-z` - incremental fix for that version.
# What is Factorio?
@ -23,7 +22,7 @@ You will be mining resources, researching technologies, building infrastructure,
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.
NOTE: This is only the server. The game is available at [factorio.com](https://www.factorio.com) and [Steam](http://store.steampowered.com/app/427520/).
NOTE: This is only the server. The full game is available at [Factorio.com](https://www.factorio.com), [Steam](https://store.steampowered.com/app/427520/), [GOG.com](https://www.gog.com/game/factorio) and [Humble Bundle](https://www.humblebundle.com/store/factorio).
# Usage
@ -41,7 +40,7 @@ sudo docker run -d \
-v /opt/factorio:/factorio \
--name factorio \
--restart=always \
dtandersen/factorio
factoriotools/factorio
```
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 \
--name factorio \
dtandersen/factorio
factoriotools/factorio
docker attach factorio
@ -95,7 +94,7 @@ Delete the container and refresh the image:
docker stop 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!
@ -113,6 +112,8 @@ To generate a new map stop the server, delete all of the saves and restart the s
Copy mods into the mods folder and restart the server.
As of 0.17 a new environment variable was added ``UPDATE_MODS_ON_START`` which if set to ``true`` will cause the mods get to updated on server start. If set a valid [Factorio Username and Token](https://www.factorio.com/profile) must be supplied or else the server will not start. They can either be set as docker secrets, environment variables, or pulled from the server-settings.json file.
## Scenarios
@ -126,13 +127,13 @@ docker run -d \
--name factorio \
--restart=always \
--entrypoint "/scenario.sh" \
dtandersen/factorio \
factoriotools/factorio \
MyScenarioName
```
## 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 \
@ -142,7 +143,7 @@ docker run -d \
--name factorio \
--restart=always \
--entrypoint "/scenario2map.sh" \
dtandersen/factorio
factoriotools/factorio
MyScenarioName
```
@ -190,7 +191,7 @@ Example which replaces the server-settings.json:
factorio_1:
image: dtanders/factorio
image: factoriotools/factorio
ports:
- "34197:34197/udp"
volumes:
@ -240,11 +241,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.
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
cd docker_factorio_server/0.16
git clone https://github.com/factoriotools/factorio-docker.git
cd docker_factorio_server/0.17
```
Or make your own:
@ -253,7 +254,7 @@ Or make your own:
version: '2'
services:
factorio:
image: dtandersen/factorio
image: factoriotools/factorio
ports:
- "34197:34197/udp"
- "27015:27015/tcp"
@ -278,8 +279,8 @@ sudo docker-compose up -d
## Environment Variables
* `PORT` (0.15+) - Start the server on an alterate 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"`.
* `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 alternate port, .e.g. `docker run -e "RCON_PORT=34198"`.
## LAN Games
@ -304,7 +305,7 @@ sudo docker run -d \
-v /opt/factorio:/factorio \
--name factorio \
--restart=always \
dtandersen/factorio
factoriotools/factorio
```
## Vagrant
@ -318,6 +319,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
```
## 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
**My server is listed in the server browser, but nobody can connect**
@ -335,11 +340,13 @@ Use the `PORT` environment variable to start the server on the a different port,
# Contributors
* [dtandersen](https://github.com/dtandersen/docker_factorio_server) - Maintainer
* [Fank](https://github.com/Fankserver/docker-factorio-watchdog) - Keeper of the Factorio watchdog that keeps the version up-to-date.
* [DBendit](https://github.com/DBendit/docker_factorio_server) - Admin list, ban list, version updates
* [Zopanix](https://github.com/zopanix/docker_factorio_server) - Originator
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Randomly generate RCON password
* [gnomus](https://github.com/gnomus/docker_factorio_server) - White listing
* [bplein](https://github.com/bplein/docker_factorio_server) - Scenario support
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Version update
* [dtandersen](https://github.com/dtandersen) - Maintainer
* [Fank](https://github.com/Fankserver) - Keeper of the Factorio watchdog that keeps the version up-to-date.
* [SuperSandro2000](https://github.com/supersandro2000) - CI Guy, Maintainer and runner of the Factorio watchdog, contributed version updates
* [DBendit](https://github.com/DBendit/docker_factorio_server) - Coded admin list, ban list support and contributed version updates
* [Zopanix](https://github.com/zopanix/docker_factorio_server) - Original Author
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Coded randomly generated RCON password
* [gnomus](https://github.com/gnomus/docker_factorio_server) - Coded wite listing support
* [bplein](https://github.com/bplein/docker_factorio_server) - Coded scenario support
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Contributed version updates
* [carlbennett](https://github.com/carlbennett) - Contributed version updates and bugfixes

97
build.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/bash
set -eoux pipefail
if [[ -z ${1:-} ]] && [[ -n ${CI:-} ]]; then
echo 'Usage: ./build.sh VERSION_SHORT'
exit 1
elif [[ ${CI:-} == true ]] || [[ -n ${1:-} ]]; 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 1
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 [[ -n ${CI:-} ]]; then
# we are either on master or on a tag build
if [[ $TRAVIS_BRANCH == master ]] || [[ $TRAVIS_BRANCH == "$VERSION" ]]; then
TAGS="-t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
# we are on an incremental build of a tag
elif [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; then
TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
# we build a other branch than master
elif [[ -n $TRAVIS_BRANCH ]]; then
TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH"
fi
else
# we are not in CI and tag version and version short
TAGS="-t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
fi
if [[ -n ${EXTRA_TAG:-} ]]; then
IFS=","
for TAG in $EXTRA_TAG; do
TAGS+=" -t $DOCKER_REPO:$TAG"
done
fi
if [[ ${STABLE:-} == "$VERSION" ]]; then
TAGS+=" -t $DOCKER_REPO:stable"
fi
fi
# shellcheck disable=SC2068
eval docker build . ${TAGS[@]}
docker images
if [[ ${TRAVIS_BRANCH:-} ]]; then
TRAVIS_BRANCH_VERSION=${TRAVIS_BRANCH%-*}
fi
# only push when:
# latest changes where made in the folder corosponding to the version we build, we are on master and don#t build a PR.
if [[ $(dirname "$(git diff --name-only HEAD^)") =~ $VERSION_SHORT ]] && [[ ${TRAVIS_BRANCH:-} == master ]] && [[ $TRAVIS_PULL_REQUEST_BRANCH == "" ]] ||
# we build a tag and we are not on master
[[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" ]] && [[ ${TRAVIS_PULL_REQUEST_BRANCH:-} == "" ]] ||
# we are not in CI
[[ -z ${CI:-} ]]; then
if [[ ${CI:-} == true ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
# push a tag on a branch other than master
if [[ -n ${TRAVIS_BRANCH:-} ]] && [[ $VERSION != "${TRAVIS_BRANCH_VERSION:-}" ]] && [[ ${TRAVIS_BRANCH:-} != "master" ]]; then
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
fi
# push an incremental tag
if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" ]]; then
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
fi
if [[ -n ${TRAVIS_TAG:-} ]] || [[ -z ${CI:-} ]]; then
docker push "$DOCKER_REPO:$VERSION"
docker push "$DOCKER_REPO:$VERSION_SHORT"
fi
if [[ -n ${EXTRA_TAG:-} ]]; then
IFS=","
for TAG in $EXTRA_TAG; do
docker push "$DOCKER_REPO:$TAG"
done
fi
if [[ ${STABLE:-} == "$VERSION" ]]; then
docker push "$DOCKER_REPO:stable"
fi
curl -X POST https://hooks.microbadger.com/images/factoriotools/factorio/TmmKGNp8jKcFqZvcJhTCIAJVluw=
fi

2
lint.sh Executable file
View File

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