Skip to content

Instantly share code, notes, and snippets.

@mthalman
Created April 12, 2024 00:54
Show Gist options
  • Save mthalman/b3e7957418cc933431640a7bb61f97d0 to your computer and use it in GitHub Desktop.
Save mthalman/b3e7957418cc933431640a7bb61f97d0 to your computer and use it in GitHub Desktop.
Chiseled PowerShell
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment