-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Dockerfiles for nanoserver
Signed-off-by: Stefan Scherer <[email protected]>
- Loading branch information
1 parent
73b0a6e
commit ebdf10a
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM microsoft/nanoserver | ||
|
||
ENV NPM_CONFIG_LOGLEVEL info | ||
ENV NODE_VERSION 4.5.0 | ||
ENV NODE_SHA256 16aab15b29e79746d1bae708f6a5dbed8ef3c87426a9408f7261163d0cda0f56 | ||
|
||
RUN powershell.exe -Command \ | ||
$ErrorActionPreference = 'Stop' ; \ | ||
$handler = New-Object System.Net.Http.HttpClientHandler ; \ | ||
$client = New-Object System.Net.Http.HttpClient($handler) ; \ | ||
$client.Timeout = New-Object System.TimeSpan(0, 30, 0) ; \ | ||
$cancelTokenSource = [System.Threading.CancellationTokenSource]::new() ; \ | ||
$responseMsg = $client.GetAsync([System.Uri]::new('https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-win-x64.zip'), $cancelTokenSource.Token) ; \ | ||
$responseMsg.Wait() ; \ | ||
$downloadedFileStream = [System.IO.FileStream]::new('C:\node.zip', [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write) ; \ | ||
$response = $responseMsg.Result ; \ | ||
$copyStreamOp = $response.Content.CopyToAsync($downloadedFileStream) ; \ | ||
$copyStreamOp.Wait() ; \ | ||
$downloadedFileStream.Close() ; \ | ||
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip','c:\') ; \ | ||
Rename-Item 'C:\node-v%NODE_VERSION%-win-x64' 'C:\nodejs' ; \ | ||
New-Item '%APPDATA%\npm' ; \ | ||
$env:PATH = 'C:\nodejs;%APPDATA%\npm;' + $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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:4.5.0-nanoserver | ||
|
||
RUN mkdir \app | ||
WORKDIR /app | ||
|
||
ONBUILD COPY package.json package.json | ||
ONBUILD RUN npm install & rd /s /q %APPDATA%\npm-cache & for /d %G in ("%TEMP%\npm-*") do rd /s /q "%~G" | ||
ONBUILD COPY . . | ||
|
||
CMD [ "npm.cmd", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM microsoft/nanoserver | ||
|
||
ENV NPM_CONFIG_LOGLEVEL info | ||
ENV NODE_VERSION 6.4.0 | ||
ENV NODE_SHA256 bb994370e43c1539e11588a86e69064459141b6984b705f1c79a1a13181193b9 | ||
|
||
RUN powershell.exe -Command \ | ||
$ErrorActionPreference = 'Stop' ; \ | ||
$handler = New-Object System.Net.Http.HttpClientHandler ; \ | ||
$client = New-Object System.Net.Http.HttpClient($handler) ; \ | ||
$client.Timeout = New-Object System.TimeSpan(0, 30, 0) ; \ | ||
$cancelTokenSource = [System.Threading.CancellationTokenSource]::new() ; \ | ||
$responseMsg = $client.GetAsync([System.Uri]::new('https://nodejs.org/dist/v%NODE_VERSION%/node-v%NODE_VERSION%-win-x64.zip'), $cancelTokenSource.Token) ; \ | ||
$responseMsg.Wait() ; \ | ||
$downloadedFileStream = [System.IO.FileStream]::new('C:\node.zip', [System.IO.FileMode]::Create, [System.IO.FileAccess]::Write) ; \ | ||
$response = $responseMsg.Result ; \ | ||
$copyStreamOp = $response.Content.CopyToAsync($downloadedFileStream) ; \ | ||
$copyStreamOp.Wait() ; \ | ||
$downloadedFileStream.Close() ; \ | ||
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\node.zip','c:\') ; \ | ||
Rename-Item 'C:\node-v%NODE_VERSION%-win-x64' 'C:\nodejs' ; \ | ||
New-Item '%APPDATA%\npm' ; \ | ||
$env:PATH = 'C:\nodejs;%APPDATA%\npm;' + $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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:6.4.0-nanoserver | ||
|
||
RUN mkdir \app | ||
WORKDIR /app | ||
|
||
ONBUILD COPY package.json package.json | ||
ONBUILD RUN npm install & rd /s /q %APPDATA%\npm-cache & for /d %G in ("%TEMP%\npm-*") do rd /s /q "%~G" | ||
ONBUILD COPY . . | ||
|
||
CMD [ "npm.cmd", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
docker build --isolation=hyperv -t node:4.5.0-nanoserver 4.5/windows/nanoserver | ||
docker build --isolation=hyperv -t node:4.5.0-nanoserver-onbuild 4.5/windows/nanoserver/onbuild | ||
|
||
docker build --isolation=hyperv -t node:6.4.0-nanoserver 6.4/windows/nanoserver | ||
docker build --isolation=hyperv -t node:6.4.0-nanoserver-onbuild 6.4/windows/nanoserver/onbuild |