ci: fix container permission error

This commit is contained in:
Darkraise
2026-02-02 17:06:38 +07:00
parent 77dc45700e
commit 58a48dfc91
3 changed files with 22 additions and 22 deletions
+6 -6
View File
@@ -33,7 +33,7 @@ setup_user() {
# Check if we need to modify UID/GID
if [ "$current_uid" != "$PUID" ] || [ "$current_gid" != "$PGID" ]; then
echo "🔧 Adjusting user permissions..."
echo "🔧 Adjusting user UID/GID..."
echo " PUID: $PUID (was: $current_uid)"
echo " PGID: $PGID (was: $current_gid)"
@@ -56,13 +56,13 @@ setup_user() {
fi
usermod -u "$PUID" $APP_USER 2>/dev/null || true
fi
# Fix ownership of app directories
echo " Fixing ownership of /app directories..."
chown -R $APP_USER:$APP_GROUP /app/data /app/logs 2>/dev/null || true
else
echo "✅ User permissions OK (UID=$PUID, GID=$PGID)"
echo "✅ User UID/GID OK (UID=$PUID, GID=$PGID)"
fi
# Always fix ownership of mounted directories (volumes override container permissions)
echo "🔧 Ensuring correct ownership of data directories..."
chown -R $APP_USER:$APP_GROUP /app/data /app/logs 2>/dev/null || true
}
# Only setup user if running as root
+10 -10
View File
@@ -31,7 +31,7 @@ setup_user() {
# Check if we need to modify UID/GID
if [ "$current_uid" != "$PUID" ] || [ "$current_gid" != "$PGID" ]; then
echo "🔧 Adjusting user permissions..."
echo "🔧 Adjusting user UID/GID..."
echo " PUID: $PUID (was: $current_uid)"
echo " PGID: $PGID (was: $current_gid)"
@@ -56,17 +56,17 @@ setup_user() {
# Alpine uses different syntax
sed -i "s/^${APP_USER}:x:[0-9]*:[0-9]*:/${APP_USER}:x:${PUID}:${PGID}:/" /etc/passwd 2>/dev/null || true
fi
# Fix ownership of nginx directories
echo " Fixing ownership of nginx directories..."
chown -R $APP_USER:$APP_GROUP /usr/share/nginx/html 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /var/cache/nginx 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /var/log/nginx 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /etc/nginx/conf.d 2>/dev/null || true
chown $APP_USER:$APP_GROUP /var/run/nginx.pid 2>/dev/null || true
else
echo "✅ User permissions OK (UID=$PUID, GID=$PGID)"
echo "✅ User UID/GID OK (UID=$PUID, GID=$PGID)"
fi
# Always fix ownership of nginx directories (in case of mounted volumes)
echo "🔧 Ensuring correct ownership of nginx directories..."
chown -R $APP_USER:$APP_GROUP /usr/share/nginx/html 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /var/cache/nginx 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /var/log/nginx 2>/dev/null || true
chown -R $APP_USER:$APP_GROUP /etc/nginx/conf.d 2>/dev/null || true
chown $APP_USER:$APP_GROUP /var/run/nginx.pid 2>/dev/null || true
}
# Only setup user if running as root
+6 -6
View File
@@ -31,7 +31,7 @@ setup_user() {
# Check if we need to modify UID/GID
if [ "$current_uid" != "$PUID" ] || [ "$current_gid" != "$PGID" ]; then
echo "🔧 Adjusting user permissions..."
echo "🔧 Adjusting user UID/GID..."
echo " PUID: $PUID (was: $current_uid)"
echo " PGID: $PGID (was: $current_gid)"
@@ -54,13 +54,13 @@ setup_user() {
fi
usermod -u "$PUID" $APP_USER 2>/dev/null || true
fi
# Fix ownership of app directories
echo " Fixing ownership of /app directories..."
chown -R $APP_USER:$APP_GROUP /app/logs 2>/dev/null || true
else
echo "✅ User permissions OK (UID=$PUID, GID=$PGID)"
echo "✅ User UID/GID OK (UID=$PUID, GID=$PGID)"
fi
# Always fix ownership of mounted directories (volumes override container permissions)
echo "🔧 Ensuring correct ownership of data directories..."
chown -R $APP_USER:$APP_GROUP /app/logs 2>/dev/null || true
}
# Only setup user if running as root