Skip to content

Commit 51f0384

Browse files
committed
Introduce Dockerfiles for nanoserver
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
1 parent 6a396ac commit 51f0384

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

4.6/windows/nanoserver/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM microsoft/nanoserver
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
ENV NPM_CONFIG_LOGLEVEL info
6+
ENV NODE_VERSION 4.6.0
7+
ENV NODE_SHA256 0782bd50251c2a159fba5b874c56fb4a6680f454cc16892cee8e62d17b7d6f60
8+
9+
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
10+
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip', 'C:\') ; \
11+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
12+
New-Item $($env:APPDATA + '\npm') ; \
13+
$env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
14+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
15+
Remove-Item -Path node.zip
16+
17+
CMD [ "node.exe" ]
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:4.6.0-nanoserver
2+
3+
RUN mkdir \app
4+
WORKDIR /app
5+
6+
ONBUILD COPY package.json package.json
7+
ONBUILD RUN npm install ; Remove-Item $($env:APPDATA + '\npm-cache') -Force -Recurse ; Remove-Item $($env:TEMP + '\npm-*') -Force -Recurse
8+
ONBUILD COPY . .
9+
10+
CMD [ "npm.cmd", "start" ]

6.7/windows/nanoserver/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM microsoft/nanoserver
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
4+
5+
ENV NPM_CONFIG_LOGLEVEL info
6+
ENV NODE_VERSION 6.7.0
7+
ENV NODE_SHA256 59971f8ea9fb1ac4c55ca36303fe32a0714049cf8a10843dbb5924a5d0624659
8+
9+
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
10+
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip', 'C:\') ; \
11+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
12+
New-Item $($env:APPDATA + '\npm') ; \
13+
$env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
14+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
15+
Remove-Item -Path node.zip
16+
17+
CMD [ "node.exe" ]
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:6.7.0-nanoserver
2+
3+
RUN mkdir \app
4+
WORKDIR /app
5+
6+
ONBUILD COPY package.json package.json
7+
ONBUILD RUN npm install ; Remove-Item $($env:APPDATA + '\npm-cache') -Force -Recurse ; Remove-Item $($env:TEMP + '\npm-*') -Force -Recurse
8+
ONBUILD COPY . .
9+
10+
CMD [ "npm.cmd", "start" ]

test-build.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
docker build --isolation=hyperv -t node:4.6.0-nanoserver 4.6/windows/nanoserver
2+
docker build --isolation=hyperv -t node:4.6.0-nanoserver-onbuild 4.6/windows/nanoserver/onbuild
3+
4+
docker build --isolation=hyperv -t node:6.7.0-nanoserver 6.7/windows/nanoserver
5+
docker build --isolation=hyperv -t node:6.7.0-nanoserver-onbuild 6.7/windows/nanoserver/onbuild

0 commit comments

Comments
 (0)