Add nanoserver insider dockerfile (#4212)

* remove empty file

* add nanoserver insider docker image

* remove entrypoint and add cmd

* update docker repo to be an argument

* update docker files for POSIX syntax changes

* add comments
This commit is contained in:
Travis Plunk
2017-07-10 17:10:21 -07:00
committed by GitHub
parent bb0cd656e4
commit 7bcbcb3c4c
10 changed files with 53 additions and 8 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ Successfully built ee667ad86a7b
### Run the docker image you built
```sh
PS /powershell/docker/release/ubuntu16.04> docker run -it ps-ubuntu.16.04 '$psversiontable'
PS /powershell/docker/release/ubuntu16.04> docker run -it ps-ubuntu.16.04 powershell -c '$psversiontable'
Name Value
---- -----
+1 -1
View File
@@ -25,4 +25,4 @@ RUN yum install -y \
# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
ENTRYPOINT [ "powershell" ]
CMD [ "powershell" ]
+1 -1
View File
@@ -63,4 +63,4 @@ RUN curl -SLO ${LIBICU50_SOURCE}/${LIBICU50_PACKAGE} \
ENV LD_LIBRARY_PATH /opt/microsoft/powershell/$POWERSHELL_VERSION/usr/lib64
# Use array to avoid Docker prepending /bin/sh -c
ENTRYPOINT [ "powershell" ]
CMD [ "powershell" ]
+43
View File
@@ -0,0 +1,43 @@
# escape=`
# Args used by from statements must be defined here:
ARG NanoServerVersion=10.0.16237.1001
ARG WindowsServerCoreVersion=10.0.16237.1001
ARG WindowsServerCoreRepo=microsoft/windowsservercore-insider
ARG NanoServerRepo=microsoft/nanoserver-insider
# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM ${WindowsServerCoreRepo}:$WindowsServerCoreVersion AS installer-env
# Arguments for installing powershell, must be defined in the container they are used
ARG PS_VERSION=6.0.0-beta.3
ARG PS_DOWNLOAD_SHA=FF45FE7D184B50297CA706EFAEA4E37C59807D33577521A715C147BCD5098B01
ENV PS_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win10-win2016-x64.zip
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Invoke-WebRequest $Env:PS_DOWNLOAD_URL -OutFile powershell.zip
RUN if ((Get-FileHash powershell.zip -Algorithm sha256).Hash -ne $Env:PS_DOWNLOAD_SHA) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
exit 1; `
}
RUN Expand-Archive powershell.zip -DestinationPath \PowerShell
# Install PowerShell into NanoServer
FROM ${NanoServerRepo}:$NanoServerVersion
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
LABEL readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL description="This Dockerfile will install the latest release of PS."
# Copy Powershell from the installer containter
ENV ProgramFiles C:\Program Files
COPY --from=installer-env ["\\PowerShell\\", "$ProgramFiles\\PowerShell"]
# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE="$ProgramFiles\PowerShell\PowerShell.exe"
# setx /M fails on nanoserver-insider, setting the user path
RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell"
CMD ["C:\\Program Files\\PowerShell\\PowerShell.exe"]
+2 -1
View File
@@ -7,6 +7,7 @@ LABEL description="This Dockerfile will install the latest release of PS."
ARG POWERSHELL_ZIP=https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.3/PowerShell-6.0.0-beta.3-win10-win2016-x64.zip
RUN setx /M PATH "%PATH%;%ProgramFiles%\PowerShell"
# Setup PowerShell - Log-to > C:\Docker.log
SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
ADD $POWERSHELL_ZIP /powershell-win10-x64.zip
@@ -42,4 +43,4 @@ RUN Start-Transcript -path C:\Dockerfile.log -append -IncludeInvocationHeader ;
# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE='"C:\Program Files\PowerShell\latest\PowerShell.exe"'
ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\PowerShell.exe"]
CMD ["C:\\Program Files\\PowerShell\\latest\\PowerShell.exe"]
+1 -1
View File
@@ -27,4 +27,4 @@ ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
ENTRYPOINT [ "powershell" ]
CMD [ "powershell" ]
+1 -1
View File
@@ -33,4 +33,4 @@ RUN apt-get update \
# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
ENTRYPOINT [ "powershell" ]
CMD [ "powershell" ]
+1 -1
View File
@@ -34,4 +34,4 @@ RUN apt-get update \
# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
ENTRYPOINT [ "powershell" ]
CMD [ "powershell" ]
+2 -1
View File
@@ -7,6 +7,7 @@ LABEL description="This Dockerfile will install the latest release of PS."
ARG POWERSHELL_MSI=https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.3/PowerShell-6.0.0-beta.3-win10-win2016-x64.msi
RUN setx /M PATH "%PATH%;%ProgramFiles%\PowerShell"
# Setup PowerShell - Log-to > C:\Docker.log
SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
ADD $POWERSHELL_MSI /PowerShell-win10-x64.msi
@@ -42,4 +43,4 @@ RUN Start-Transcript -path C:\Dockerfile.log -append -IncludeInvocationHeader ;
# Persist %PSCORE% ENV variable for user convenience
ENV PSCORE='"C:\Program Files\PowerShell\latest\PowerShell.exe"'
ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\PowerShell.exe"]
CMD ["C:\\Program Files\\PowerShell\\latest\\PowerShell.exe"]