Skip to content

Instantly share code, notes, and snippets.

@harishrathi
Last active December 13, 2016 11:27
Show Gist options
  • Save harishrathi/a89b0d50655801467100b414b08f09a8 to your computer and use it in GitHub Desktop.
Save harishrathi/a89b0d50655801467100b414b08f09a8 to your computer and use it in GitHub Desktop.
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" ]
FROM stefanscherer/node-windows:7.2.1-nano
MAINTAINER Harish Rathi <harish.rathi@gmail.com>
RUN ["powershell", "New-Item","-type", "directory", "c:\\app"]
COPY . /app/
WORKDIR /app/
RUN ["powershell", "pwd"]
RUN ["powershell", "npm", "install"]
EXPOSE 3000
ENTRYPOINT ["powershell", "npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment