Skip to content

Commit ff34bb9

Browse files
lbussellCopilot
andauthored
Fix nested pwsh invocation for non-root user in SDK images (#7207)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 02f3dc2 commit ff34bb9

72 files changed

Lines changed: 91 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eng/dockerfile-templates/sdk/Dockerfile.linux.install-powershell

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RUN powershell_version={{VARIABLES[cat("powershell|", dotnetVersion, "|build-ver
2323
&& rm {{nupkgName}} \
2424
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
2525
&& chmod 755 /usr/share/powershell/pwsh \
26+
&& chmod 755 /usr/share/powershell/.store/powershell.{{lcase(nupkgPlatform)}}/$powershell_version/powershell.{{lcase(nupkgPlatform)}}/$powershell_version/tools/*/any/pwsh \
2627
# To reduce image size, remove the copy nupkg that nuget keeps.
2728
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm{{if isAlpine: \
2829
# Add ncurses-terminfo-base to resolve psreadline dependency

src/sdk/10.0/alpine3.23/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RUN powershell_version=7.6.1 \
6161
&& rm PowerShell.Linux.Alpine.$powershell_version.nupkg \
6262
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6363
&& chmod 755 /usr/share/powershell/pwsh \
64+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.alpine/$powershell_version/powershell.linux.alpine/$powershell_version/tools/*/any/pwsh \
6465
# To reduce image size, remove the copy nupkg that nuget keeps.
6566
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm \
6667
# Add ncurses-terminfo-base to resolve psreadline dependency

src/sdk/10.0/azurelinux3.0/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ RUN powershell_version=7.6.1 \
6161
&& rm PowerShell.Linux.x64.$powershell_version.nupkg \
6262
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6363
&& chmod 755 /usr/share/powershell/pwsh \
64+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.x64/$powershell_version/powershell.linux.x64/$powershell_version/tools/*/any/pwsh \
6465
# To reduce image size, remove the copy nupkg that nuget keeps.
6566
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/azurelinux3.0/arm64v8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ RUN powershell_version=7.6.1 \
6161
&& rm PowerShell.Linux.arm64.$powershell_version.nupkg \
6262
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6363
&& chmod 755 /usr/share/powershell/pwsh \
64+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.arm64/$powershell_version/powershell.linux.arm64/$powershell_version/tools/*/any/pwsh \
6465
# To reduce image size, remove the copy nupkg that nuget keeps.
6566
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/noble/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.x64.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.x64/$powershell_version/powershell.linux.x64/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/noble/arm32v7/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.arm32.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.arm32/$powershell_version/powershell.linux.arm32/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/noble/arm64v8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.arm64.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.arm64/$powershell_version/powershell.linux.arm64/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/resolute/amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.x64.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.x64/$powershell_version/powershell.linux.x64/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/resolute/arm32v7/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.arm32.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.arm32/$powershell_version/powershell.linux.arm32/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

src/sdk/10.0/resolute/arm64v8/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ RUN powershell_version=7.6.1 \
5959
&& rm PowerShell.Linux.arm64.$powershell_version.nupkg \
6060
&& ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
6161
&& chmod 755 /usr/share/powershell/pwsh \
62+
&& chmod 755 /usr/share/powershell/.store/powershell.linux.arm64/$powershell_version/powershell.linux.arm64/$powershell_version/tools/*/any/pwsh \
6263
# To reduce image size, remove the copy nupkg that nuget keeps.
6364
&& find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

0 commit comments

Comments
 (0)