|
| 1 | +FROM microsoft/windowsservercore as download |
| 2 | + |
| 3 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 4 | + |
| 5 | +ENV NODE_VERSION 10.4.0 |
| 6 | + |
| 7 | +ENV GPG_VERSION 2.3.4 |
| 8 | + |
| 9 | +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ |
| 10 | + Invoke-WebRequest $('https://files.gpg4win.org/gpg4win-vanilla-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg4win.exe' -UseBasicParsing ; \ |
| 11 | + Start-Process .\gpg4win.exe -ArgumentList '/S' -NoNewWindow -Wait ; |
| 12 | + |
| 13 | +RUN @( \ |
| 14 | + '94AE36675C464D64BAFA68DD7434390BDBE9B9C5', \ |
| 15 | + 'FD3A5288F042B6850C66B31F09FE44734EB7990E', \ |
| 16 | + '71DCFD284A79C3B38668286BC97EC7A07EDE3FC1', \ |
| 17 | + 'DD8F2338BAE7501E3DD5AC78C273792F7D83545D', \ |
| 18 | + 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \ |
| 19 | + 'B9AE9905FFD7803F25714661B63B535A4C206CA9', \ |
| 20 | + '56730D5401028683275BD23C23EFEFE93C4CFFFE', \ |
| 21 | + '77984A986EBC2AA786BC0F66B01FBB92821C587A', \ |
| 22 | + '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' \ |
| 23 | + ) | foreach { \ |
| 24 | + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys $_ ; \ |
| 25 | + } ; \ |
| 26 | + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ |
| 27 | + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \ |
| 28 | + gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \ |
| 29 | + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ |
| 30 | + $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ |
| 31 | + if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ |
| 32 | + Expand-Archive node.zip -DestinationPath C:\ ; \ |
| 33 | + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' |
| 34 | + |
| 35 | +ENV YARN_VERSION 1.7.0 |
| 36 | + |
| 37 | +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 ; \ |
| 38 | + Invoke-WebRequest $('https://yarnpkg.com/downloads/{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ |
| 39 | + $sig = Get-AuthenticodeSignature -filepath yarn.msi ; \ |
| 40 | + if ($sig.Status -ne 'Valid') { Write-Error 'Authenticode signature is not valid' } ; \ |
| 41 | + if (@( \ |
| 42 | + 'AF764E1EA56C762617BDC757C8B0F3780A0CF5F9' \ |
| 43 | + ) -notcontains $sig.SignerCertificate.Thumbprint) { Write-Error 'Unknown signer certificate' } ; \ |
| 44 | + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait |
| 45 | + |
| 46 | +FROM microsoft/windowsservercore |
| 47 | + |
| 48 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 49 | + |
| 50 | +ENV NODE_VERSION 10.4.0 |
| 51 | +ENV YARN_VERSION 1.7.0 |
| 52 | + |
| 53 | +COPY --from=download /nodejs /nodejs |
| 54 | +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] |
| 55 | + |
| 56 | +RUN New-Item $($env:APPDATA + '\npm') -Type Directory ; \ |
| 57 | + $env:PATH = 'C:\nodejs;{0}\npm;C:\yarn\bin;{1}' -f $env:APPDATA, $env:PATH ; \ |
| 58 | + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) |
| 59 | + |
| 60 | +CMD [ "node.exe" ] |
0 commit comments