diff --git a/0.17/Dockerfile b/0.17/Dockerfile index 59efc67..b957cd7 100644 --- a/0.17/Dockerfile +++ b/0.17/Dockerfile @@ -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 su-exec binutils gettext libintl && \ + apk add --update --no-cache pwgen su-exec binutils gettext libintl shadow && \ apk add --update --no-cache --virtual .build-deps curl && \ curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \ -o /tmp/factorio_headless_x64_$VERSION.tar.xz && \ diff --git a/0.17/docker-compose.yml b/0.17/docker-compose.yml index b43bcc6..74622c3 100644 --- a/0.17/docker-compose.yml +++ b/0.17/docker-compose.yml @@ -7,5 +7,6 @@ services: - "27015:27015/tcp" volumes: - /opt/factorio:/factorio -# user: 845:845 -# user: 1000:1000 +# environment: +# - PUID=1000 +# - PGID=1000 diff --git a/0.17/files/docker-entrypoint.sh b/0.17/files/docker-entrypoint.sh index 2529651..d2550a7 100755 --- a/0.17/files/docker-entrypoint.sh +++ b/0.17/files/docker-entrypoint.sh @@ -35,6 +35,9 @@ if find -L $SAVES -iname \*.tmp.zip -mindepth 1 -print | grep -q .; then fi if [ "$(id -u)" = '0' ]; then + # Update the User and Group ID based on the PUID/PGID variables + usermod -u $PUID factorio + groupmod -g $PGID factorio # Take ownership of factorio data if running as root chown -R factorio:factorio $FACTORIO_VOL # Make sure we own temp