1
+ FROM mcr.microsoft.com/windows/servercore:ltsc2019 as installer
2
+
3
+ SHELL ["powershell" , "-Command" , "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';" ]
4
+
5
+ # PATH isn't actually set in the Docker image, so we have to set it from within the container
6
+ RUN $newPath = ('C:\P rogram Files (x86)\G nuPG\b in;{0}' -f $env:PATH); \
7
+ Write-Host ('Updating PATH: {0}' -f $newPath); \
8
+ [Environment]::SetEnvironmentVariable('PATH' , $newPath, [EnvironmentVariableTarget]::Machine)
9
+ # doing this first to share cache across versions more aggressively
10
+
11
+ ENV NODE_VERSION 22.7.0
12
+ ENV NODE_CHECKSUM 3fc638727974262b4f65a6b1b43c22fb2d80671cdcb50e1237e0b05d1330aaf7
13
+
14
+ ENV GPG_VERSION 2.4.5_20240307
15
+
16
+ RUN Invoke-WebRequest $('https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg-installer.exe' ; \
17
+ Start-Process -FilePath 'gpg-installer.exe' -ArgumentList '/S' -Wait; \
18
+ gpg --version;
19
+
20
+ RUN @( \
21
+ '4ED778F539E3634C779C87C6D7062848A1AB005C' , \
22
+ '141F07595B7B3FFE74309A937405533BE57C7D57' , \
23
+ '74F12602B6F1C4E913FAA37AD3A89613643B6201' , \
24
+ 'DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7' , \
25
+ '61FC681DFB92A079F1685E77973F295594EC4689' , \
26
+ '8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600' , \
27
+ 'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8' , \
28
+ '890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4' , \
29
+ 'C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C' , \
30
+ '108F52B48DB57BB0CC439B2997B01419BD92F80A' , \
31
+ 'A363A499291CBBC940DD62E41F10027AF002F8B0' , \
32
+ 'CC68F5A3106FF448322E48ED27F5E38D5B0A215F' \
33
+ ) | foreach { \
34
+ gpg --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
35
+ } ; \
36
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
37
+ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
38
+ gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
39
+ Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
40
+ $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
41
+ if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
42
+ Expand-Archive node.zip -DestinationPath C:\ ; \
43
+ Rename-Item -Path $('C:\n ode-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\n odejs'
44
+
45
+ FROM mcr.microsoft.com/windows/servercore:ltsc2019 as runner
46
+
47
+ SHELL ["powershell" , "-Command" , "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';" ]
48
+
49
+ RUN $newPath = ('C:\n odejs;{0}' -f $env:PATH); \
50
+ Write-Host ('Updating PATH: {0}' -f $newPath); \
51
+ [Environment]::SetEnvironmentVariable('PATH' , $newPath, [EnvironmentVariableTarget]::Machine)
52
+
53
+ COPY --from=installer C:/nodejs C:/nodejs
54
+
55
+ COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
56
+ ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
57
+
58
+ # Smoke test
59
+ RUN node --version; \
60
+ npm --version;
61
+
62
+ CMD [ "node.exe" ]
0 commit comments