From 51f0384944434fb3c94a39991b18537c4854e252 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.6/windows/nanoserver/Dockerfile | 17 +++++++++++++++++ 4.6/windows/nanoserver/onbuild/Dockerfile | 10 ++++++++++ 6.7/windows/nanoserver/Dockerfile | 17 +++++++++++++++++ 6.7/windows/nanoserver/onbuild/Dockerfile | 10 ++++++++++ test-build.ps1 | 5 +++++ 5 files changed, 59 insertions(+) create mode 100644 4.6/windows/nanoserver/Dockerfile create mode 100644 4.6/windows/nanoserver/onbuild/Dockerfile create mode 100644 6.7/windows/nanoserver/Dockerfile create mode 100644 6.7/windows/nanoserver/onbuild/Dockerfile create mode 100755 test-build.ps1 diff --git a/4.6/windows/nanoserver/Dockerfile b/4.6/windows/nanoserver/Dockerfile new file mode 100644 index 0000000000..52d0560117 --- /dev/null +++ b/4.6/windows/nanoserver/Dockerfile @@ -0,0 +1,17 @@ +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 4.6.0 +ENV NODE_SHA256 0782bd50251c2a159fba5b874c56fb4a6680f454cc16892cee8e62d17b7d6f60 + +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip', '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.6/windows/nanoserver/onbuild/Dockerfile b/4.6/windows/nanoserver/onbuild/Dockerfile new file mode 100644 index 0000000000..0ae749a143 --- /dev/null +++ b/4.6/windows/nanoserver/onbuild/Dockerfile @@ -0,0 +1,10 @@ +FROM node:4.6.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.7/windows/nanoserver/Dockerfile b/6.7/windows/nanoserver/Dockerfile new file mode 100644 index 0000000000..5743c53c8b --- /dev/null +++ b/6.7/windows/nanoserver/Dockerfile @@ -0,0 +1,17 @@ +FROM microsoft/nanoserver + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 6.7.0 +ENV NODE_SHA256 59971f8ea9fb1ac4c55ca36303fe32a0714049cf8a10843dbb5924a5d0624659 + +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip', '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.7/windows/nanoserver/onbuild/Dockerfile b/6.7/windows/nanoserver/onbuild/Dockerfile new file mode 100644 index 0000000000..ec89ace1cf --- /dev/null +++ b/6.7/windows/nanoserver/onbuild/Dockerfile @@ -0,0 +1,10 @@ +FROM node:6.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/test-build.ps1 b/test-build.ps1 new file mode 100755 index 0000000000..48ca1a134a --- /dev/null +++ b/test-build.ps1 @@ -0,0 +1,5 @@ +docker build --isolation=hyperv -t node:4.6.0-nanoserver 4.6/windows/nanoserver +docker build --isolation=hyperv -t node:4.6.0-nanoserver-onbuild 4.6/windows/nanoserver/onbuild + +docker build --isolation=hyperv -t node:6.7.0-nanoserver 6.7/windows/nanoserver +docker build --isolation=hyperv -t node:6.7.0-nanoserver-onbuild 6.7/windows/nanoserver/onbuild