Skip to content

Commit 22202cd

Browse files
jespinoona-agent
andcommitted
Use dynamic npx path detection instead of hardcoded paths
Replace hardcoded /usr/bin/npx and /usr/local/bin/npx with $(which npx) to handle different npx installation locations. Co-authored-by: Ona <no-reply@ona.com>
1 parent ccae376 commit 22202cd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

gitpod/gitpod.Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ FROM gitpod/workspace-full:latest
33
# Disable npm lifecycle scripts and npx for security
44
RUN npm config set ignore-scripts true --location=user && \
55
echo 'ignore-scripts true' >> ~/.yarnrc && \
6-
rm -f /usr/bin/npx /usr/local/bin/npx && \
7-
echo '#!/bin/sh' > /usr/local/bin/npx && \
8-
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \
9-
echo 'exit 1' >> /usr/local/bin/npx && \
10-
chmod +x /usr/local/bin/npx
6+
NPX_PATH=$(which npx) && \
7+
rm -f "$NPX_PATH" && \
8+
echo '#!/bin/sh' > "$NPX_PATH" && \
9+
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> "$NPX_PATH" && \
10+
echo 'exit 1' >> "$NPX_PATH" && \
11+
chmod +x "$NPX_PATH"
1112

1213
# Cache firebase
1314
RUN npm install --global --ignore-scripts npm firebase firebase-tools

0 commit comments

Comments
 (0)