Skip to content

Commit 1c0afbd

Browse files
committed
fix(native): remove sudo dependency and run as root in container
- Remove sudo usage (not available in Alpine container) - Run npm/pnpm commands as root with unsafe-perm flag - Set HOME environment variable for proper config - Use root user throughout container build process
1 parent 890f60f commit 1c0afbd

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.github/actions/build-native-binaries/action.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,17 @@ runs:
6363
--env npm_config_arch=$npm_config_arch \
6464
--env npm_config_target_arch=$npm_config_target_arch \
6565
--env TMPDIR=/app/tmp \
66+
--env HOME=/app \
6667
${{ inputs.container-image }} \
6768
sh -c "
68-
# Fix ownership and create temp directory
69-
chown -R node:node /app &&
69+
# Create temp directory and set up environment
7070
mkdir -p /app/tmp &&
71-
# Switch to node user for build
72-
sudo -u node npm config set cache /app/tmp/.npm --global &&
73-
sudo -u node pnpm install --frozen-lockfile &&
74-
sudo -u node pnpm run build:native &&
71+
# Configure npm for root user
72+
npm config set cache /app/tmp/.npm --global &&
73+
npm config set unsafe-perm true --global &&
74+
# Install and build as root (required in container)
75+
pnpm install --frozen-lockfile &&
76+
pnpm run build:native &&
7577
echo '✅ Native module compiled successfully'
7678
"
7779

0 commit comments

Comments
 (0)