From 445a3291cca2e258b38a5e1bae05b03e564b7eb8 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Sun, 6 Jul 2025 19:35:51 +0900 Subject: [PATCH] fix: Address linting issues in rootless Docker implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add --no-install-recommends to apt-get install in Dockerfile - Consolidate consecutive RUN instructions in Dockerfile - Fix shellcheck warnings: quote variables and use -n instead of \! -z - These changes improve best practices without affecting functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docker/Dockerfile.rootless | 10 ++++------ docker/files/docker-entrypoint-rootless.sh | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile.rootless b/docker/Dockerfile.rootless index b5a10dd..078b89f 100644 --- a/docker/Dockerfile.rootless +++ b/docker/Dockerfile.rootless @@ -1,7 +1,7 @@ # build rcon client FROM debian:stable-slim AS rcon-builder RUN apt-get -q update \ - && DEBIAN_FRONTEND=noninteractive apt-get -qy install build-essential + && DEBIAN_FRONTEND=noninteractive apt-get -qy install build-essential --no-install-recommends WORKDIR /src COPY rcon/ /src @@ -78,11 +78,9 @@ COPY files/docker-entrypoint-rootless.sh /docker-entrypoint.sh COPY files/config.ini /opt/factorio/config/config.ini COPY --from=rcon-builder /src/rcon /bin/rcon -# Make all scripts executable -RUN chmod +x /*.sh - -# Set proper permissions for the factorio directory -RUN chmod -R 777 /opt/factorio /factorio +# Make all scripts executable and set proper permissions for the factorio directory +RUN chmod +x /*.sh \ + && chmod -R 777 /opt/factorio /factorio VOLUME /factorio EXPOSE $PORT/udp $RCON_PORT/tcp diff --git a/docker/files/docker-entrypoint-rootless.sh b/docker/files/docker-entrypoint-rootless.sh index 081e108..129dc4f 100755 --- a/docker/files/docker-entrypoint-rootless.sh +++ b/docker/files/docker-entrypoint-rootless.sh @@ -44,11 +44,11 @@ fi # Update mods if requested if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then - ${INSTALLED_DIRECTORY}/docker-update-mods.sh + "${INSTALLED_DIRECTORY}"/docker-update-mods.sh fi # Handle DLC -${INSTALLED_DIRECTORY}/docker-dlc.sh +"${INSTALLED_DIRECTORY}"/docker-dlc.sh # In rootless mode, we don't need to handle user switching or chown # The container runs as the specified user from the start @@ -76,7 +76,7 @@ if [[ $GENERATE_NEW_SAVE == true ]]; then if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation" else - if [[ ! -z "$PRESET" ]]; then + if [[ -n "$PRESET" ]]; then $EXEC /opt/factorio/bin/x64/factorio \ --create "$SAVES/$SAVE_NAME.zip" \ --preset "$PRESET" \