Last active
July 7, 2024 18:29
-
-
Save yipo/a3dcf0fa443fdabd01533ca78a88b7dd to your computer and use it in GitHub Desktop.
Build a PowerShell Docker image based on Alpine Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1 | |
| # Based on the installation instructions on the following page. | |
| # https://learn.microsoft.com/powershell/scripting/install/install-alpine | |
| FROM alpine/curl AS download | |
| ARG package=https://github.com/PowerShell/PowerShell/releases/download/v7.4.3/powershell-7.4.3-linux-musl-x64.tar.gz | |
| RUN curl -L $package -o /tmp/powershell.tar.gz | |
| WORKDIR /tmp/release | |
| RUN tar zxf /tmp/powershell.tar.gz | |
| RUN chmod +x pwsh | |
| FROM alpine:3.17 | |
| RUN apk add --no-cache ca-certificates less ncurses-terminfo-base \ | |
| krb5-libs libgcc libintl libssl1.1 libstdc++ tzdata userspace-rcu zlib icu-libs | |
| RUN apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache lttng-ust | |
| COPY --from=download /tmp/release /opt/microsoft/powershell/7 | |
| RUN ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh | |
| ENTRYPOINT ["pwsh"] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-5/alpine317/docker/Dockerfile