diff --git a/0.17/Dockerfile b/0.17/Dockerfile index 05c1a36..c9278a7 100644 --- a/0.17/Dockerfile +++ b/0.17/Dockerfile @@ -18,7 +18,7 @@ ENV PORT=34197 \ SCRIPTOUTPUT=/factorio/script-output RUN mkdir -p /opt /factorio && \ - apk add --update --no-cache pwgen su-exec binutils && \ + 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 && \ diff --git a/README.md b/README.md index b2f4889..4c3908d 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,31 @@ Create file `config/server-adminlist.json` and add the adminlisted users. "friend" ] +## Customize configuration files (0.17.x+) + +Out-of-the box, factorio does not support environment variables inside the configuration files. A workaround is the usage of `envsubst` which generates the configuration files dynamically during startup from environment variables set in docker-compose: + +Example which replaces the server-settings.json: + + + factorio_1: + image: dtanders/factorio + ports: + - "34197:34197/udp" + volumes: + - /opt/factorio:/factorio + - ./server-settings.json:/server-settings.json + environment: + - INSTANCE_NAME=Your Instance's Name + - INSTANCE_DESC=Your Instance's Description + entrypoint: /bin/sh -c "mkdir -p /factorio/config && envsubst < /server-settings.json > /factorio/config/server-settings.json && exec /docker-entrypoint.sh" + +The `server-settings.json` file may then contain the variable references like this: + + "name": "${INSTANCE_NAME}", + "description": "${INSTANCE_DESC}", + + # Container Details The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).