fix: Address linting issues in rootless Docker implementation

- 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 <noreply@anthropic.com>
This commit is contained in:
Florian Kinder
2025-07-06 19:35:51 +09:00
parent 7e59315e3d
commit 445a3291cc
2 changed files with 7 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# build rcon client # build rcon client
FROM debian:stable-slim AS rcon-builder FROM debian:stable-slim AS rcon-builder
RUN apt-get -q update \ 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 WORKDIR /src
COPY rcon/ /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 files/config.ini /opt/factorio/config/config.ini
COPY --from=rcon-builder /src/rcon /bin/rcon COPY --from=rcon-builder /src/rcon /bin/rcon
# Make all scripts executable # Make all scripts executable and set proper permissions for the factorio directory
RUN chmod +x /*.sh RUN chmod +x /*.sh \
&& chmod -R 777 /opt/factorio /factorio
# Set proper permissions for the factorio directory
RUN chmod -R 777 /opt/factorio /factorio
VOLUME /factorio VOLUME /factorio
EXPOSE $PORT/udp $RCON_PORT/tcp EXPOSE $PORT/udp $RCON_PORT/tcp

View File

@ -44,11 +44,11 @@ fi
# Update mods if requested # Update mods if requested
if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
${INSTALLED_DIRECTORY}/docker-update-mods.sh "${INSTALLED_DIRECTORY}"/docker-update-mods.sh
fi fi
# Handle DLC # 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 # In rootless mode, we don't need to handle user switching or chown
# The container runs as the specified user from the start # 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 if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then
echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation" echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation"
else else
if [[ ! -z "$PRESET" ]]; then if [[ -n "$PRESET" ]]; then
$EXEC /opt/factorio/bin/x64/factorio \ $EXEC /opt/factorio/bin/x64/factorio \
--create "$SAVES/$SAVE_NAME.zip" \ --create "$SAVES/$SAVE_NAME.zip" \
--preset "$PRESET" \ --preset "$PRESET" \