Skip to content

Commit 492bdab

Browse files
committed
Introduce Dockerfiles for nanoserver
Signed-off-by: Stefan Scherer <[email protected]>
1 parent b5949cd commit 492bdab

File tree

7 files changed

+92
-0
lines changed

7 files changed

+92
-0
lines changed

4.7/windows/nanoserver/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM microsoft/nanoserver
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
4+
5+
ENV NPM_CONFIG_LOGLEVEL info
6+
ENV NODE_VERSION 4.7.0
7+
ENV NODE_SHA256 8b257f217ad882deffc2cd37d3aed7b8bbe57da1c4eb0b3b54cb529dff8ce811
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+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
11+
Expand-Archive node.zip -DestinationPath C:\ ; \
12+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
13+
New-Item $($env:APPDATA + '\npm') ; \
14+
$env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
15+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
16+
Remove-Item -Path node.zip
17+
18+
CMD [ "node.exe" ]
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:4.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" ]

6.9/windows/nanoserver/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM microsoft/nanoserver
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
4+
5+
ENV NPM_CONFIG_LOGLEVEL info
6+
ENV NODE_VERSION 6.9.2
7+
ENV NODE_SHA256 3525201f28c2298953c4e0b03fe4fb080bf295ec9a722af2abbaa4ad53d3b491
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+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
11+
Expand-Archive node.zip -DestinationPath C:\ ; \
12+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
13+
New-Item $($env:APPDATA + '\npm') ; \
14+
$env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
15+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
16+
Remove-Item -Path node.zip
17+
18+
CMD [ "node.exe" ]
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:6.9.2-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" ]

7.2/windows/nanoserver/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM microsoft/nanoserver
2+
3+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
4+
5+
ENV NPM_CONFIG_LOGLEVEL info
6+
ENV NODE_VERSION 7.2.1
7+
ENV NODE_SHA256 960ce0e9da98650c0cb86f9550d558996b2e13cff4c376991e74a852babe76ac
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+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
11+
Expand-Archive node.zip -DestinationPath C:\ ; \
12+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
13+
New-Item $($env:APPDATA + '\npm') ; \
14+
$env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \
15+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \
16+
Remove-Item -Path node.zip
17+
18+
CMD [ "node.exe" ]
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:7.2.1-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

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
docker build --isolation=hyperv -t node:4.7.0-nanoserver 4.7/windows/nanoserver
2+
docker build --isolation=hyperv -t node:4.7.0-nanoserver-onbuild 4.7/windows/nanoserver/onbuild
3+
4+
docker build --isolation=hyperv -t node:6.9.2-nanoserver 6.9/windows/nanoserver
5+
docker build --isolation=hyperv -t node:6.9.2-nanoserver-onbuild 6.9/windows/nanoserver/onbuild
6+
7+
docker build --isolation=hyperv -t node:7.2.1-nanoserver 7.2/windows/nanoserver
8+
docker build --isolation=hyperv -t node:7.2.1-nanoserver-onbuild 7.2/windows/nanoserver/onbuild

0 commit comments

Comments
 (0)