|
1 | | -# escape=` |
2 | | -# Args used by from statements must be defined here: |
3 | | -ARG NanoServerVersion=10.0.16257.1000 |
4 | | -ARG WindowsServerCoreVersion=10.0.16257.1000 |
5 | | -ARG WindowsServerCoreRepo=microsoft/windowsservercore-insider |
6 | | -ARG NanoServerRepo=microsoft/nanoserver-insider |
7 | | - |
8 | | -# Use server core as an installer container to extract PowerShell, |
9 | | -# As this is a multi-stage build, this stage will eventually be thrown away |
10 | | -FROM ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env |
11 | | - |
12 | | -# Arguments for installing powershell, must be defined in the container they are used |
13 | | -ARG PS_VERSION=6.0.0-beta.7 |
14 | | - |
15 | | -ENV PS_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip |
16 | | - |
17 | | -SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
18 | | -RUN Invoke-WebRequest $Env:PS_DOWNLOAD_URL -OutFile powershell.zip |
19 | | - |
20 | | -RUN Expand-Archive powershell.zip -DestinationPath \PowerShell |
21 | | - |
22 | | -# Install PowerShell into NanoServer |
23 | | -FROM ${NanoServerRepo}:$NanoServerVersion |
24 | | - |
25 | | -ARG VCS_REF="none" |
26 | | -ARG PS_VERSION=6.0.0-beta.7 |
27 | | -ARG IMAGE_NAME=microsoft/nanoserver-insider-powershell |
28 | | - |
29 | | -LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" ` |
30 | | - readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` |
31 | | - description="This Dockerfile will install the latest release of PS." ` |
32 | | - org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" ` |
33 | | - org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` |
34 | | - org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell" ` |
35 | | - org.label-schema.name="powershell" ` |
36 | | - org.label-schema.vcs-ref=${VCS_REF} ` |
37 | | - org.label-schema.vendor="PowerShell" ` |
38 | | - org.label-schema.version=${PS_VERSION} ` |
39 | | - org.label-schema.schema-version="1.0" ` |
40 | | - org.label-schema.docker.cmd="docker run ${IMAGE_NAME} powershell -c '$psversiontable'" ` |
41 | | - org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" ` |
42 | | - org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} powershell -c Invoke-Pester" ` |
43 | | - org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} powershell -c Get-Help" |
44 | | - |
45 | | -# Copy Powershell from the installer containter |
46 | | -ENV ProgramFiles C:\Program Files |
47 | | -COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] |
48 | | - |
49 | | -# Persist %PSCORE% ENV variable for user convenience |
50 | | -ENV PSCORE="$ProgramFiles\PowerShell\PowerShell.exe" |
51 | | - |
52 | | -# Set the path |
53 | | -RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell" |
54 | | - |
55 | | -CMD ["PowerShell.exe"] |
| 1 | +# escape=` |
| 2 | +# Args used by from statements must be defined here: |
| 3 | +ARG NanoServerVersion=10.0.16257.1000 |
| 4 | +ARG WindowsServerCoreVersion=10.0.16257.1000 |
| 5 | +ARG WindowsServerCoreRepo=microsoft/windowsservercore-insider |
| 6 | +ARG NanoServerRepo=microsoft/nanoserver-insider |
| 7 | + |
| 8 | +# Use server core as an installer container to extract PowerShell, |
| 9 | +# As this is a multi-stage build, this stage will eventually be thrown away |
| 10 | +FROM ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env |
| 11 | + |
| 12 | +# Arguments for installing powershell, must be defined in the container they are used |
| 13 | +ARG PS_VERSION=6.0.0-beta.7 |
| 14 | + |
| 15 | +ENV PS_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip |
| 16 | + |
| 17 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 18 | +RUN Invoke-WebRequest $Env:PS_DOWNLOAD_URL -OutFile powershell.zip |
| 19 | + |
| 20 | +RUN Expand-Archive powershell.zip -DestinationPath \PowerShell |
| 21 | + |
| 22 | +# Install PowerShell into NanoServer |
| 23 | +FROM ${NanoServerRepo}:$NanoServerVersion |
| 24 | + |
| 25 | +ARG VCS_REF="none" |
| 26 | +ARG PS_VERSION=6.0.0-beta.7 |
| 27 | +ARG IMAGE_NAME=microsoft/nanoserver-insider-powershell |
| 28 | + |
| 29 | +LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" ` |
| 30 | + readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` |
| 31 | + description="This Dockerfile will install the latest release of PS." ` |
| 32 | + org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" ` |
| 33 | + org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" ` |
| 34 | + org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell" ` |
| 35 | + org.label-schema.name="powershell" ` |
| 36 | + org.label-schema.vcs-ref=${VCS_REF} ` |
| 37 | + org.label-schema.vendor="PowerShell" ` |
| 38 | + org.label-schema.version=${PS_VERSION} ` |
| 39 | + org.label-schema.schema-version="1.0" ` |
| 40 | + org.label-schema.docker.cmd="docker run ${IMAGE_NAME} powershell -c '$psversiontable'" ` |
| 41 | + org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" ` |
| 42 | + org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} powershell -c Invoke-Pester" ` |
| 43 | + org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} powershell -c Get-Help" |
| 44 | + |
| 45 | +# Copy Powershell from the installer containter |
| 46 | +ENV ProgramFiles C:\Program Files |
| 47 | +COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"] |
| 48 | + |
| 49 | +# Persist %PSCORE% ENV variable for user convenience |
| 50 | +ENV PSCORE="$ProgramFiles\PowerShell\PowerShell.exe" |
| 51 | + |
| 52 | +# Set the path |
| 53 | +RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell" |
| 54 | + |
| 55 | +CMD ["PowerShell.exe"] |
0 commit comments