From 492bdabc4385ea3abb8300bee8419f0cada1963c Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Thu, 25 Aug 2016 18:08:03 +0200 Subject: [PATCH] Introduce Dockerfiles for nanoserver Signed-off-by: Stefan Scherer --- 4.7/windows/nanoserver/Dockerfile | 18 ++++++++++++++++++ 4.7/windows/nanoserver/onbuild/Dockerfile | 10 ++++++++++ 6.9/windows/nanoserver/Dockerfile | 18 ++++++++++++++++++ 6.9/windows/nanoserver/onbuild/Dockerfile | 10 ++++++++++ 7.2/windows/nanoserver/Dockerfile | 18 ++++++++++++++++++ 7.2/windows/nanoserver/onbuild/Dockerfile | 10 ++++++++++ test-build.ps1 | 8 ++++++++ 7 files changed, 92 insertions(+) create mode 100644 4.7/windows/nanoserver/Dockerfile create mode 100644 4.7/windows/nanoserver/onbuild/Dockerfile create mode 100644 6.9/windows/nanoserver/Dockerfile create mode 100644 6.9/windows/nanoserver/onbuild/Dockerfile create mode 100644 7.2/windows/nanoserver/Dockerfile create mode 100644 7.2/windows/nanoserver/onbuild/Dockerfile create mode 100755 test-build.ps1 diff --git a/4.7/windows/nanoserver/Dockerfile b/4.7/windows/nanoserver/Dockerfile new file mode 100644 index 0000000000..a2ad22c514 --- /dev/null +++ b/4.7/windows/nanoserver/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 4.7.0 +ENV NODE_SHA256 8b257f217ad882deffc2cd37d3aed7b8bbe57da1c4eb0b3b54cb529dff8ce811 + +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \ + New-Item $($env:APPDATA + '\npm') ; \ + $env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ + Remove-Item -Path node.zip + +CMD [ "node.exe" ] diff --git a/4.7/windows/nanoserver/onbuild/Dockerfile b/4.7/windows/nanoserver/onbuild/Dockerfile new file mode 100644 index 0000000000..4cb5e9132c --- /dev/null +++ b/4.7/windows/nanoserver/onbuild/Dockerfile @@ -0,0 +1,10 @@ +FROM node:4.7.0-nanoserver + +RUN mkdir \app +WORKDIR /app + +ONBUILD COPY package.json package.json +ONBUILD RUN npm install ; Remove-Item $($env:APPDATA + '\npm-cache') -Force -Recurse ; Remove-Item $($env:TEMP + '\npm-*') -Force -Recurse +ONBUILD COPY . . + +CMD [ "npm.cmd", "start" ] diff --git a/6.9/windows/nanoserver/Dockerfile b/6.9/windows/nanoserver/Dockerfile new file mode 100644 index 0000000000..f1b6c37700 --- /dev/null +++ b/6.9/windows/nanoserver/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 6.9.2 +ENV NODE_SHA256 3525201f28c2298953c4e0b03fe4fb080bf295ec9a722af2abbaa4ad53d3b491 + +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \ + New-Item $($env:APPDATA + '\npm') ; \ + $env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ + Remove-Item -Path node.zip + +CMD [ "node.exe" ] diff --git a/6.9/windows/nanoserver/onbuild/Dockerfile b/6.9/windows/nanoserver/onbuild/Dockerfile new file mode 100644 index 0000000000..c17c427fa4 --- /dev/null +++ b/6.9/windows/nanoserver/onbuild/Dockerfile @@ -0,0 +1,10 @@ +FROM node:6.9.2-nanoserver + +RUN mkdir \app +WORKDIR /app + +ONBUILD COPY package.json package.json +ONBUILD RUN npm install ; Remove-Item $($env:APPDATA + '\npm-cache') -Force -Recurse ; Remove-Item $($env:TEMP + '\npm-*') -Force -Recurse +ONBUILD COPY . . + +CMD [ "npm.cmd", "start" ] diff --git a/7.2/windows/nanoserver/Dockerfile b/7.2/windows/nanoserver/Dockerfile new file mode 100644 index 0000000000..25b12b9b0e --- /dev/null +++ b/7.2/windows/nanoserver/Dockerfile @@ -0,0 +1,18 @@ +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 7.2.1 +ENV NODE_SHA256 960ce0e9da98650c0cb86f9550d558996b2e13cff4c376991e74a852babe76ac + +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \ + New-Item $($env:APPDATA + '\npm') ; \ + $env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ + Remove-Item -Path node.zip + +CMD [ "node.exe" ] diff --git a/7.2/windows/nanoserver/onbuild/Dockerfile b/7.2/windows/nanoserver/onbuild/Dockerfile new file mode 100644 index 0000000000..cfb8f6e392 --- /dev/null +++ b/7.2/windows/nanoserver/onbuild/Dockerfile @@ -0,0 +1,10 @@ +FROM node:7.2.1-nanoserver + +RUN mkdir \app +WORKDIR /app + +ONBUILD COPY package.json package.json +ONBUILD RUN npm install ; Remove-Item $($env:APPDATA + '\npm-cache') -Force -Recurse ; Remove-Item $($env:TEMP + '\npm-*') -Force -Recurse +ONBUILD COPY . . + +CMD [ "npm.cmd", "start" ] diff --git a/test-build.ps1 b/test-build.ps1 new file mode 100755 index 0000000000..ee0dbd4562 --- /dev/null +++ b/test-build.ps1 @@ -0,0 +1,8 @@ +docker build --isolation=hyperv -t node:4.7.0-nanoserver 4.7/windows/nanoserver +docker build --isolation=hyperv -t node:4.7.0-nanoserver-onbuild 4.7/windows/nanoserver/onbuild + +docker build --isolation=hyperv -t node:6.9.2-nanoserver 6.9/windows/nanoserver +docker build --isolation=hyperv -t node:6.9.2-nanoserver-onbuild 6.9/windows/nanoserver/onbuild + +docker build --isolation=hyperv -t node:7.2.1-nanoserver 7.2/windows/nanoserver +docker build --isolation=hyperv -t node:7.2.1-nanoserver-onbuild 7.2/windows/nanoserver/onbuild