Skip to content

Commit fe50656

Browse files
committed
chore: allow overriding permission changes
1 parent 0007076 commit fe50656

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

apps/cleanuparr/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RUN dotnet_archive=dotnet-runtime-${DOTNET_VERSION}-linux-x64.tar.gz \
4242
LABEL org.opencontainers.image.title="Cleanuparr"
4343

4444
WORKDIR /app
45-
COPY --from=cloner /app .
45+
COPY --from=cloner --chown=568:568 /app .
4646
COPY --chmod=0755 ./apps/cleanuparr/promknight-entrypoint.sh /promknight-entrypoint.sh
4747
ENV PUID=568 \
4848
PGID=568 \

apps/cleanuparr/promknight-entrypoint.sh

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,32 @@ cat << "EOF"
2121
2222
EOF
2323

24-
# Create group if it doesn't exist
25-
if ! getent group "$PGID" > /dev/null 2>&1; then
26-
echo "Creating group with GID $PGID"
27-
groupadd -g "$PGID" appgroup
24+
if [ "$SEED_USER" = "true" ]; then
25+
# Create group if it doesn't exist
26+
if ! getent group "$PGID" > /dev/null 2>&1; then
27+
echo "Creating group with GID $PGID"
28+
groupadd -g "$PGID" appgroup
29+
fi
30+
31+
# Create user if it doesn't exist
32+
if ! getent passwd "$PUID" > /dev/null 2>&1; then
33+
echo "Creating user with UID $PUID"
34+
useradd -u "$PUID" -g "$PGID" -s /bin/bash -M appuser
35+
fi
36+
37+
# Change ownership of app directory if not running as root
38+
if [ "$PUID" != "0" ] || [ "$PGID" != "0" ]; then
39+
mkdir -p /config || true
40+
chown -R "$PUID:$PGID" /app
41+
chown -R "$PUID:$PGID" /config
42+
fi
2843
fi
2944

30-
# Create user if it doesn't exist
31-
if ! getent passwd "$PUID" > /dev/null 2>&1; then
32-
echo "Creating user with UID $PUID"
33-
useradd -u "$PUID" -g "$PGID" -s /bin/bash -M appuser
34-
fi
35-
36-
# Change ownership of app directory if not running as root
37-
if [ "$PUID" != "0" ] || [ "$PGID" != "0" ]; then
38-
mkdir -p /config || true
39-
chown -R "$PUID:$PGID" /app
40-
chown -R "$PUID:$PGID" /config
41-
fi
42-
43-
# Execute the main command as the specified user
45+
# Execute the main command
4446
if [ "$PUID" = "0" ] && [ "$PGID" = "0" ]; then
4547
# Running as root, no need for gosu
4648
exec /app/Cleanuparr "$@"
4749
else
4850
# Use gosu to drop privileges
4951
exec gosu "$PUID:$PGID" /app/Cleanuparr "$@"
50-
fi
52+
fi

0 commit comments

Comments
 (0)