FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS installer
RUN mkdir /pwsh-symlink \
&& ln -s /usr/share/powershell/pwsh /pwsh-symlink/pwsh
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled
COPY --from=installer /usr/share/powershell /usr/share/powershell
COPY --from=installer ["/pwsh-symlink", "/usr/bin"]
> docker run --rm -it --entrypoint pwsh my-image -Command Get-ChildItem /usr/share/dotnet
Directory: /usr/share/dotnet
UnixMode User Group LastWriteTime Size Name
-------- ---- ----- ------------- ---- ----
drwxrwxr-x root root 03/19/2024 19:52 4096 host
drwxrwxr-x root root 03/19/2024 19:52 4096 shared
-rwxr-xr-x root root 03/19/2024 19:48 68376 dotnet
-rw-rw-r-- root root 03/19/2024 19:46 1116 LICENSE.txt
-rw-rw-r-- root root 03/19/2024 19:46 94355 ThirdPartyNotices.txt