Compare commits

...

49 Commits

Author SHA1 Message Date
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
12 changed files with 265 additions and 120 deletions

View File

@ -5,16 +5,16 @@ LABEL maintainer="https://github.com/factoriotools/factorio-docker"
ENV VERSION=0.14.23 \
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
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
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

@ -7,18 +7,18 @@ ENV PORT=34197 \
VERSION=0.15.40 \
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
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
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

@ -19,23 +19,23 @@ ENV PORT=34197 \
PUID="$PUID" \
PGID="$PGID"
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
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

View File

@ -9,8 +9,8 @@ ARG PGID=845
ENV PORT=34197 \
RCON_PORT=27015 \
VERSION=0.17.42 \
SHA1=7904a813526b0e59adbb85cd0018eafdd12590ab \
VERSION=0.17.65 \
SHA1=521b601b0be04520ae6d6a04bdfc9c7db897f85d \
SAVES=/factorio/saves \
CONFIG=/factorio/config \
MODS=/factorio/mods \
@ -19,23 +19,23 @@ ENV PORT=34197 \
PUID="$PUID" \
PGID="$PGID"
RUN mkdir -p /opt /factorio && \
apk add --update --no-cache pwgen su-exec binutils gettext libintl 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
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

@ -10,3 +10,6 @@ services:
# environment:
# - PUID=1000
# - PGID=1000
# - UPDATE_MODS_ON_START=true
# - USERNAME=FactorioUsername
# - TOKEN=FactorioToken

View File

@ -1,7 +1,5 @@
#!/bin/sh -x
set -euo pipefail
id
#!/bin/bash
set -eoux pipefail
FACTORIO_VOL=/factorio
mkdir -p "$FACTORIO_VOL"
@ -11,31 +9,35 @@ 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
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"
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"
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"
fi
NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l )
if [ "$NRTMPSAVES" -gt 0 ]; then
if [[ $NRTMPSAVES -gt 0 ]]; then
# Delete incomplete saves (such as after a forced exit)
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
@ -47,8 +49,8 @@ else
SU_EXEC=""
fi
NRSAVES=$( find -L "$SAVES" -iname \*.zip -mindepth 1 | wc -l )
if [ "$NRSAVES" -eq 0 ]; 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" \

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,13 +1,11 @@
#!/bin/sh -x
if [ -z "$1" ]; then
#!/bin/bash
set -eoux pipefail
if [[ -z ${1:-} ]]; then
echo "No argument supplied"
fi
SERVER_SCENARIO="$1"
set -euo pipefail
id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
@ -15,19 +13,19 @@ mkdir -p "$SCENARIOS"
#chown -R factorio /factorio
if [ ! -f "$CONFIG/rconpw" ]; then
if [[ ! -f $CONFIG/rconpw ]]; then
pwgen 15 1 >"$CONFIG/rconpw"
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"
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"
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"
fi
@ -36,6 +34,7 @@ exec /opt/factorio/bin/x64/factorio \
--start-server-load-scenario "$SERVER_SCENARIO" \
--server-settings "$CONFIG/server-settings.json" \
--server-whitelist "$CONFIG/server-whitelist.json" \
--use-server-whitelist \
--server-banlist "$CONFIG/server-banlist.json" \
--rcon-port "$RCON_PORT" \
--rcon-password "$(cat "$CONFIG/rconpw")" \

View File

@ -1,27 +1,25 @@
#!/bin/sh -x
if [ -z "$1" ]; then
#!/bin/bash
set -eoux pipefail
if [[ -z ${1:-} ]]; then
echo "No argument supplied"
fi
SERVER_SCENARIO="$1"
set -euo pipefail
id
mkdir -p "$SAVES"
mkdir -p "$CONFIG"
mkdir -p "$MODS"
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"
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"
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"
fi

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 "$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 "$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 "$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,6 +1,6 @@
# 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?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/)
# 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.42`, `0.17`, `latest` [(0.17/Dockerfile)](https://github.com/factoriotools/factorio-docker/blob/master/0.17/Dockerfile)
* `0.17.65`, `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/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)
@ -9,9 +9,9 @@
* `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?
@ -112,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
@ -339,11 +341,12 @@ Use the `PORT` environment variable to start the server on the a different port,
# Contributors
* [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.
* [SuperSandro2000](https://github.com/supersandro2000) - CI Guy
* [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
* [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

View File

@ -1,33 +1,39 @@
#!/bin/bash
set -eox pipefail
set -eoux pipefail
if [ -z "$1" ] && [ -n "$CI" ]; then
if [[ -z ${1:-} ]] && [[ -n ${CI:-} ]]; then
echo "Usage: ./build.sh \$VERSION_SHORT"
exit 1
elif [ "$CI" == "true" ]; then
elif [[ $CI == true ]]; then
VERSION_SHORT="$1"
else
VERSION_SHORT=$(find . -maxdepth 1 -type d | sort | tail -1 | grep -o "[0-9].[0-9]*")
VERSION_SHORT=$(find . -maxdepth 1 -type d | sort | tail -1 | grep -o "[[0-9]].[[0-9]]*")
EXTRA_TAG=latest
fi
cd "$VERSION_SHORT" || exit
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
if [[ $TRAVIS_PULL_REQUEST == true ]]; then
TAGS="$DOCKER_REPO:$TRAVIS_PULL_REQUEST_SLUG"
else
if [ "$TRAVIS_BRANCH" == "master" ] || [ "$TRAVIS_BRANCH" == "$VERSION" ]; then
# we are either on master or on a tag build
if [[ $TRAVIS_BRANCH == master ]] || [[ $TRAVIS_BRANCH == "$VERSION" ]]; then
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
elif [ -n "$TRAVIS_BRANCH" ]; then
# we are on an incremental build of a tag
elif [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; then
TAGS="$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="$DOCKER_REPO:$TRAVIS_BRANCH"
elif [ "$CI" == "" ]; then
# we are not in CI and tag version and version short
elif [[ $CI == "" ]]; then
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
fi
if [ -n "$EXTRA_TAG" ]; then
if [[ -n ${EXTRA_TAG:-} ]]; then
TAGS="$TAGS -t $DOCKER_REPO:$EXTRA_TAG"
fi
fi
@ -36,22 +42,34 @@ fi
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
# 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%-*}" ]] && [[ $TRAVIS_PULL_REQUEST_BRANCH == "" ]] ||
# we are not in CI
[[ $CI == "" ]]; then
if [ "$CI" == "true" ]; then
if [[ $CI == true ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
if [ -n "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BRANCH" != "$VERSION" ]; then
# push a tag on a branch other than master
if [[ -n $TRAVIS_BRANCH ]] && [[ $VERSION != "${TRAVIS_BRANCH%-*}" ]] && [[ $TRAVIS_BRANCH != "master" ]]; then
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
fi
if [ -n "$TRAVIS_TAG" ] || [ "$CI" == "" ]; then
# push an incremental tag
if [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; 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
if [[ -n ${EXTRA_TAG:-} ]]; then
docker push "$DOCKER_REPO:$EXTRA_TAG"
fi