mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 14:38:05 +02:00
Compare commits
52 Commits
Author | SHA1 | Date | |
---|---|---|---|
6ae5795d38 | |||
29ee60236e | |||
7028eb72f6 | |||
dfeb95d614 | |||
f8c62978ee | |||
28598a42a3 | |||
4ba56ee010 | |||
d2a02e8a66 | |||
5b24f8ac74 | |||
e3466a9800 | |||
e6f66a2100 | |||
18153f3f46 | |||
62e1a9f266 | |||
be7ecddb0d | |||
43599d0c23 | |||
6fb4cbc600 | |||
fe0e8f9b91 | |||
f76e88cea1 | |||
cbaa20cdea | |||
b3c134d396 | |||
9bdb79b494 | |||
77d83b4152 | |||
25d4edf14f | |||
e16b111c0b | |||
09e1ad2045 | |||
2efa39084f | |||
77edb05109 | |||
2eea2a25e4 | |||
98ea8a27c1 | |||
956af65a2b | |||
b5c1dff7b4 | |||
ee5b023911 | |||
045ef7a214 | |||
bbc2d42302 | |||
0173eab54c | |||
f868aa16ad | |||
5cd0c40975 | |||
778d982c6d | |||
9d2c38df65 | |||
b2a4195e13 | |||
18ccac666d | |||
830d042e4b | |||
a0868ba653 | |||
7002778ab5 | |||
44371283b6 | |||
d421adab67 | |||
b0cedbbe1b | |||
010b96e0b0 | |||
621ccf4282 | |||
1204b97fca | |||
aef16e83a7 | |||
605ca74c0e |
14
.hadolint.yaml
Normal file
14
.hadolint.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
ignored:
|
||||
# ignore apt version pinning
|
||||
- DL3008
|
||||
# ignore pip version pinning
|
||||
- DL3013
|
||||
# ignore apk version pinning
|
||||
- DL3018
|
||||
# ignore pipefail cause Balena/resin.io images do not work with it
|
||||
- DL4006
|
||||
# ignore false positive regex
|
||||
- SC1083
|
||||
- SC2086
|
||||
# ignore as need for debug
|
||||
- SC2005
|
27
.travis.yml
Normal file
27
.travis.yml
Normal file
@ -0,0 +1,27 @@
|
||||
dist: xenial
|
||||
sudo: required
|
||||
language: bash
|
||||
services:
|
||||
- docker
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- jq
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
script:
|
||||
- git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 -I{} sh -c 'docker run --rm -i -v ${PWD}/.hadolint.yaml:/.hadolint.yaml hadolint/hadolint < "$1"' -- {}
|
||||
- bash -c 'shopt -s globstar; shellcheck **/*.sh'
|
||||
- &build
|
||||
stage: build
|
||||
env: VERSION_SHORT=0.17 EXTRA_TAG=latest
|
||||
script:
|
||||
- ./build.sh $VERSION_SHORT
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=0.16 EXTRA_TAG=stable
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=0.15
|
||||
- <<: *build
|
||||
env: VERSION_SHORT=0.14
|
@ -1,11 +1,11 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||
FROM frolvlad/alpine-glibc:alpine-3.9
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
LABEL maintainer="https://github.com/factoriotools/factorio-docker"
|
||||
|
||||
ENV VERSION=0.14.23 \
|
||||
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
|
||||
|
||||
RUN mkdir /opt && \
|
||||
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 && \
|
||||
|
@ -30,6 +30,6 @@ 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")"
|
||||
|
@ -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 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.15.40 \
|
||||
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
|
||||
|
||||
RUN mkdir /opt && \
|
||||
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 \
|
||||
|
@ -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,10 +15,12 @@ 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 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 && \
|
||||
@ -41,6 +43,4 @@ EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||
|
||||
COPY files/ /
|
||||
|
||||
USER $USER
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
@ -3,6 +3,8 @@ set -euo pipefail
|
||||
|
||||
id
|
||||
|
||||
FACTORIO_VOL=/factorio
|
||||
mkdir -p "$FACTORIO_VOL"
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
@ -26,17 +28,29 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
fi
|
||||
|
||||
if find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then
|
||||
rm -f "$SAVES/*.tmp.zip"
|
||||
rm -f "$SAVES"/*.tmp.zip
|
||||
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"
|
||||
# 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
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
$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 /opt/factorio/bin/x64/factorio \
|
||||
$SU_EXEC /opt/factorio/bin/x64/factorio \
|
||||
--port "$PORT" \
|
||||
--start-server-load-latest \
|
||||
--server-settings "$CONFIG/server-settings.json" \
|
||||
|
@ -2,7 +2,7 @@
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO=$1
|
||||
SERVER_SCENARIO=$1
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@ -11,7 +11,7 @@ id
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIO"
|
||||
mkdir -p "$SCENARIOS"
|
||||
|
||||
#chown -R factorio /factorio
|
||||
|
||||
@ -33,7 +33,7 @@ fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port "$PORT" \
|
||||
--start-server-load-scenario "$SCENARIO" \
|
||||
--start-server-load-scenario "$SERVER_SCENARIO" \
|
||||
--server-settings "$CONFIG/server-settings.json" \
|
||||
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||
--server-banlist "$CONFIG/server-banlist.json" \
|
||||
|
@ -2,7 +2,7 @@
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO=$1
|
||||
SERVER_SCENARIO=$1
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@ -11,7 +11,7 @@ id
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIO"
|
||||
mkdir -p "$SCENARIOS"
|
||||
|
||||
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||
@ -26,4 +26,4 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--scenario2map "$SCENARIO"
|
||||
--scenario2map "$SERVER_SCENARIO"
|
||||
|
@ -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,33 +9,31 @@ ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.17.35 \
|
||||
SHA1=d651bec5e5fc25eee8770732d4cbef1461764b8d \
|
||||
VERSION=0.17.54 \
|
||||
SHA1=69750604bc9036abdf5e9297dfc975f80b52c573 \
|
||||
SAVES=/factorio/saves \
|
||||
CONFIG=/factorio/config \
|
||||
MODS=/factorio/mods \
|
||||
SCENARIOS=/factorio/scenarios \
|
||||
SCRIPTOUTPUT=/factorio/script-output \
|
||||
PUID=$PUID \
|
||||
PGID=$PGID
|
||||
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 \
|
||||
apk add --update --no-cache --no-progress bash binutils curl gettext jq libintl pwgen shadow su-exec && \
|
||||
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 && \
|
||||
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
|
||||
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 && \
|
||||
addgroup -g "$PGID" -S "$GROUP" && \
|
||||
adduser -u "$PUID" -G "$GROUP" -s /bin/sh -SDH "$USER" && \
|
||||
chown -R "$USER":"$GROUP" /opt/factorio /factorio
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
|
@ -10,3 +10,6 @@ services:
|
||||
# environment:
|
||||
# - PUID=1000
|
||||
# - PGID=1000
|
||||
# - UPDATE_MODS_ON_START=true
|
||||
# - USERNAME=FactorioUsername
|
||||
# - TOKEN=FactorioToken
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/bash -x
|
||||
set -euo pipefail
|
||||
|
||||
id
|
||||
@ -29,9 +29,14 @@ 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 [[ ${UPDATE_MODS_ON_START:-} ]]; then
|
||||
./docker-update-mods.sh
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
@ -39,14 +44,15 @@ if [ "$(id -u)" = '0' ]; then
|
||||
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
|
||||
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" \
|
||||
|
17
0.17/files/docker-update-mods.sh
Executable file
17
0.17/files/docker-update-mods.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
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 $TOKEN ]]; then
|
||||
set -- "$(jq -j ".username, \" \", .token" "$CONFIG/server-settings.json")"
|
||||
USERNAME=$1
|
||||
TOKEN=$2
|
||||
fi
|
||||
|
||||
./update-mods.sh "$VERSION" "$MODS" "$USERNAME" "$TOKEN"
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/bash -x
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO="$1"
|
||||
SERVER_SCENARIO="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@ -11,7 +11,7 @@ id
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIO"
|
||||
mkdir -p "$SCENARIOS"
|
||||
|
||||
#chown -R factorio /factorio
|
||||
|
||||
@ -33,7 +33,7 @@ fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port "$PORT" \
|
||||
--start-server-load-scenario "$SCENARIO" \
|
||||
--start-server-load-scenario "$SERVER_SCENARIO" \
|
||||
--server-settings "$CONFIG/server-settings.json" \
|
||||
--server-whitelist "$CONFIG/server-whitelist.json" \
|
||||
--server-banlist "$CONFIG/server-banlist.json" \
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/bash -x
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
fi
|
||||
SCENARIO="$1"
|
||||
SERVER_SCENARIO="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@ -11,7 +11,7 @@ id
|
||||
mkdir -p "$SAVES"
|
||||
mkdir -p "$CONFIG"
|
||||
mkdir -p "$MODS"
|
||||
mkdir -p "$SCENARIO"
|
||||
mkdir -p "$SCENARIOS"
|
||||
|
||||
if [ ! -f "$CONFIG/server-settings.json" ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json"
|
||||
@ -26,4 +26,4 @@ if [ ! -f "$CONFIG/map-settings.json" ]; then
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--scenario2map "$SCENARIO"
|
||||
--scenario2map "$SERVER_SCENARIO"
|
||||
|
94
0.17/files/update-mods.sh
Executable file
94
0.17/files/update-mods.sh
Executable file
@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
set -- "$(sha1sum "$MOD_DIR/$MOD_FILENAME")"
|
||||
if [[ $1 != "$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
|
34
README.md
34
README.md
@ -1,9 +1,9 @@
|
||||
# Factorio [](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/)
|
||||
# Factorio [](https://travis-ci.org/factoriotools/factorio-docker) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://hub.docker.com/r/factoriotools/factorio/) [](https://microbadger.com/images/factoriotools/factorio "Get your own image badge on microbadger.com")
|
||||
|
||||
* `0.17.35`, `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.17.54`, `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)
|
||||
|
||||
*Tag descriptions*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -239,10 +241,10 @@ 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.17/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.17
|
||||
```
|
||||
|
||||
@ -338,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
|
||||
|
59
build.sh
Executable file
59
build.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
set -eox pipefail
|
||||
|
||||
if [ -z "$1" ] && [ -n "$CI" ]; then
|
||||
echo "Usage: ./build.sh \$VERSION_SHORT"
|
||||
exit 1
|
||||
elif [ "$CI" == "true" ]; then
|
||||
VERSION_SHORT="$1"
|
||||
else
|
||||
VERSION_SHORT=$(find . -maxdepth 1 -type d | sort | tail -1 | grep -o "[0-9].[0-9]*")
|
||||
EXTRA_TAG=latest
|
||||
fi
|
||||
|
||||
cd "$VERSION_SHORT" || exit
|
||||
|
||||
VERSION=$(grep -oP '[0-9]+\.[0-9]+\.[0-9]+' Dockerfile | head -1)
|
||||
DOCKER_REPO=factoriotools/factorio
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
|
||||
TAGS="$DOCKER_REPO:$TRAVIS_PULL_REQUEST_SLUG"
|
||||
else
|
||||
if [ "$TRAVIS_BRANCH" == "master" ] || [ "$TRAVIS_BRANCH" == "$VERSION" ]; then
|
||||
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
|
||||
elif [ -n "$TRAVIS_BRANCH" ]; then
|
||||
TAGS="$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
elif [ "$CI" == "" ]; then
|
||||
TAGS="$DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT"
|
||||
fi
|
||||
|
||||
if [ -n "$EXTRA_TAG" ]; then
|
||||
TAGS="$TAGS -t $DOCKER_REPO:$EXTRA_TAG"
|
||||
fi
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker build . -t $TAGS
|
||||
docker images
|
||||
|
||||
if [[ "$(dirname "$(git diff --name-only HEAD^)")" =~ $VERSION_SHORT ]] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ] ||
|
||||
[ "$TRAVIS_BRANCH" == "$VERSION" ] && [ "$TRAVIS_PULL_REQUEST_BRANCH" == "" ] ||
|
||||
[ "$CI" == "" ]; then
|
||||
|
||||
if [ "$CI" == "true" ]; then
|
||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
fi
|
||||
|
||||
if [ -n "$TRAVIS_BRANCH" ] && [ "$TRAVIS_BRANCH" != "$VERSION" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
|
||||
docker push "$DOCKER_REPO:$TRAVIS_BRANCH"
|
||||
fi
|
||||
if [ -n "$TRAVIS_TAG" ] || [ "$CI" == "" ]; then
|
||||
docker push "$DOCKER_REPO:$VERSION"
|
||||
docker push "$DOCKER_REPO:$VERSION_SHORT"
|
||||
fi
|
||||
if [ -n "$EXTRA_TAG" ]; then
|
||||
docker push "$DOCKER_REPO:$EXTRA_TAG"
|
||||
fi
|
||||
|
||||
curl -X POST https://hooks.microbadger.com/images/factoriotools/factorio/TmmKGNp8jKcFqZvcJhTCIAJVluw=
|
||||
fi
|
Reference in New Issue
Block a user