Skip to content

Commit 79bf2fe

Browse files
committed
Remove gpg, multistage from windowservercore images and use NODE_CHECKSUM
Signed-off-by: Daniel Fiala <[email protected]>
1 parent e3485a7 commit 79bf2fe

File tree

8 files changed

+22
-199
lines changed

8 files changed

+22
-199
lines changed

.github/workflows/build-test-windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ jobs:
9898
exit 1
9999
}
100100
101-
- name: Verify entrypoint runs regular, non-executable files with node
101+
- name: Verify node runs regular files
102102
shell: pwsh
103103
run: |
104104
$tempDir = New-Item -ItemType Directory -Path $env:TEMP -Name "tempNodeApp"
105105
$tmp_file = Join-Path $tempDir "index.js"
106106
"console.log('success')" | Out-File -FilePath $tmp_file -Encoding utf8
107-
$output = (docker run --rm -w /app --mount "type=bind,src=$tempDir,target=c:\app" node:${{ matrix.version }}-${{ matrix.variant }} C:/app/index.js)
107+
$output = (docker run --rm -w /app --mount "type=bind,src=$tempDir,target=c:\app" node:${{ matrix.version }}-${{ matrix.variant }} node C:/app/index.js)
108108
if ($output -ne 'success') {
109-
Write-Host "Invalid"
109+
exit 1
110110
}
111111
112112
- name: Test for npm

22/windowsservercore-ltsc2019/Dockerfile

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,20 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019 as installer
33
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44

55
# PATH isn't actually set in the Docker image, so we have to set it from within the container
6-
RUN $newPath = ('C:\Program Files (x86)\GnuPG\bin;{0}' -f $env:PATH); \
7-
Write-Host ('Updating PATH: {0}' -f $newPath); \
6+
RUN $newPath = ('C:\nodejs;{0};{0}' -f $env:PATH); \
87
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
98
# doing this first to share cache across versions more aggressively
109

11-
ENV NODE_VERSION 22.8.0
12-
ENV NODE_CHECKSUM d6e1c4fca93997224cac0bec09b4201aa018f50171d38c6b85abe483012839c9
10+
ENV NODE_VERSION 22.9.0
11+
ENV NODE_CHECKSUM 8af226c0aa71fefe5228e881f4b5c5d90a8b41c290b96f44f56990d8dc3fac1c
1312

14-
# Version and checksum of the GPG installer (Source: https://www.gnupg.org/download/integrity_check.html)
15-
ENV GPG_VERSION 2.4.5_20240307
16-
ENV GPG_CHECKSUM d2ac821ceacf9409ebcdb42ae330087ada30c732981f00b356f9c2f08fac4dc1
17-
18-
RUN Invoke-WebRequest $('https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg-installer.exe'; \
19-
if ((Get-FileHash gpg-installer.exe -Algorithm sha256).Hash -ne $env:GPG_CHECKSUM) { Write-Error 'GPG checksum mismatch' }; \
20-
Start-Process -FilePath 'gpg-installer.exe' -ArgumentList '/S' -Wait; \
21-
gpg --version;
22-
23-
RUN @( \
24-
'4ED778F539E3634C779C87C6D7062848A1AB005C', \
25-
'141F07595B7B3FFE74309A937405533BE57C7D57', \
26-
'74F12602B6F1C4E913FAA37AD3A89613643B6201', \
27-
'DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7', \
28-
'61FC681DFB92A079F1685E77973F295594EC4689', \
29-
'8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600', \
30-
'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \
31-
'890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4', \
32-
'C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C', \
33-
'108F52B48DB57BB0CC439B2997B01419BD92F80A', \
34-
'A363A499291CBBC940DD62E41F10027AF002F8B0', \
35-
'CC68F5A3106FF448322E48ED27F5E38D5B0A215F' \
36-
) | foreach { \
37-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
38-
if (-not $?) { \
39-
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys $_ ; \
40-
} \
41-
} ; \
42-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
43-
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
44-
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
13+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
4514
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
46-
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
47-
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
15+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_CHECKSUM) { Write-Error 'SHA256 mismatch' } ; \
4816
Expand-Archive node.zip -DestinationPath C:\ ; \
49-
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
50-
51-
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as runner
52-
53-
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
54-
55-
COPY --from=installer C:/nodejs C:/nodejs
56-
COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
57-
58-
RUN $newPath = ('C:\nodejs;{0}' -f $env:PATH); \
59-
Write-Host ('Updating PATH: {0}' -f $newPath); \
60-
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
61-
# Because we need to use it in the current session
62-
$env:PATH = $newPath; \
17+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
18+
Remove-Item node.zip -Force ; \
6319
node --version; \
6420
npm --version;
6521

66-
ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
67-
6822
CMD [ "node.exe" ]

22/windowsservercore-ltsc2019/docker-entrypoint.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

22/windowsservercore-ltsc2022/Dockerfile

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,20 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2022 as installer
33
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44

55
# PATH isn't actually set in the Docker image, so we have to set it from within the container
6-
RUN $newPath = ('C:\Program Files (x86)\GnuPG\bin;{0}' -f $env:PATH); \
7-
Write-Host ('Updating PATH: {0}' -f $newPath); \
6+
RUN $newPath = ('C:\nodejs;{0};{0}' -f $env:PATH); \
87
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
98
# doing this first to share cache across versions more aggressively
109

11-
ENV NODE_VERSION 22.8.0
12-
ENV NODE_CHECKSUM d6e1c4fca93997224cac0bec09b4201aa018f50171d38c6b85abe483012839c9
10+
ENV NODE_VERSION 22.9.0
11+
ENV NODE_CHECKSUM 8af226c0aa71fefe5228e881f4b5c5d90a8b41c290b96f44f56990d8dc3fac1c
1312

14-
# Version and checksum of the GPG installer (Source: https://www.gnupg.org/download/integrity_check.html)
15-
ENV GPG_VERSION 2.4.5_20240307
16-
ENV GPG_CHECKSUM d2ac821ceacf9409ebcdb42ae330087ada30c732981f00b356f9c2f08fac4dc1
17-
18-
RUN Invoke-WebRequest $('https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg-installer.exe'; \
19-
if ((Get-FileHash gpg-installer.exe -Algorithm sha256).Hash -ne $env:GPG_CHECKSUM) { Write-Error 'GPG checksum mismatch' }; \
20-
Start-Process -FilePath 'gpg-installer.exe' -ArgumentList '/S' -Wait; \
21-
gpg --version;
22-
23-
RUN @( \
24-
'4ED778F539E3634C779C87C6D7062848A1AB005C', \
25-
'141F07595B7B3FFE74309A937405533BE57C7D57', \
26-
'74F12602B6F1C4E913FAA37AD3A89613643B6201', \
27-
'DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7', \
28-
'61FC681DFB92A079F1685E77973F295594EC4689', \
29-
'8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600', \
30-
'C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8', \
31-
'890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4', \
32-
'C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C', \
33-
'108F52B48DB57BB0CC439B2997B01419BD92F80A', \
34-
'A363A499291CBBC940DD62E41F10027AF002F8B0', \
35-
'CC68F5A3106FF448322E48ED27F5E38D5B0A215F' \
36-
) | foreach { \
37-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
38-
if (-not $?) { \
39-
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys $_ ; \
40-
} \
41-
} ; \
42-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
43-
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
44-
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
13+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
4514
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
46-
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
47-
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
15+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_CHECKSUM) { Write-Error 'SHA256 mismatch' } ; \
4816
Expand-Archive node.zip -DestinationPath C:\ ; \
49-
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
50-
51-
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as runner
52-
53-
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
54-
55-
COPY --from=installer C:/nodejs C:/nodejs
56-
COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
57-
58-
RUN $newPath = ('C:\nodejs;{0}' -f $env:PATH); \
59-
Write-Host ('Updating PATH: {0}' -f $newPath); \
60-
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
61-
# Because we need to use it in the current session
62-
$env:PATH = $newPath; \
17+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
18+
Remove-Item node.zip -Force ; \
6319
node --version; \
6420
npm --version;
6521

66-
ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
67-
6822
CMD [ "node.exe" ]

22/windowsservercore-ltsc2022/docker-entrypoint.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

Dockerfile-windows.template

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,20 @@ FROM mcr.microsoft.com/windows/servercore:version as installer
33
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
44

55
# PATH isn't actually set in the Docker image, so we have to set it from within the container
6-
RUN $newPath = ('C:\Program Files (x86)\GnuPG\bin;{0}' -f $env:PATH); \
7-
Write-Host ('Updating PATH: {0}' -f $newPath); \
6+
RUN $newPath = ('C:\nodejs;{0};{0}' -f $env:PATH); \
87
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
98
# doing this first to share cache across versions more aggressively
109

1110
ENV NODE_VERSION 0.0.0
1211
ENV NODE_CHECKSUM CHECKSUM_x64
1312

14-
# Version and checksum of the GPG installer (Source: https://www.gnupg.org/download/integrity_check.html)
15-
ENV GPG_VERSION 2.4.5_20240307
16-
ENV GPG_CHECKSUM d2ac821ceacf9409ebcdb42ae330087ada30c732981f00b356f9c2f08fac4dc1
17-
18-
RUN Invoke-WebRequest $('https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg-installer.exe'; \
19-
if ((Get-FileHash gpg-installer.exe -Algorithm sha256).Hash -ne $env:GPG_CHECKSUM) { Write-Error 'GPG checksum mismatch' }; \
20-
Start-Process -FilePath 'gpg-installer.exe' -ArgumentList '/S' -Wait; \
21-
gpg --version;
22-
23-
RUN @( \
24-
"${NODE_KEYS[@]}"
25-
) | foreach { \
26-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
27-
if (-not $?) { \
28-
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys $_ ; \
29-
} \
30-
} ; \
31-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
32-
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
33-
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
13+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
3414
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
35-
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
36-
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
15+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_CHECKSUM) { Write-Error 'SHA256 mismatch' } ; \
3716
Expand-Archive node.zip -DestinationPath C:\ ; \
38-
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
39-
40-
FROM mcr.microsoft.com/windows/servercore:version as runner
41-
42-
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
43-
44-
COPY --from=installer C:/nodejs C:/nodejs
45-
COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
46-
47-
RUN $newPath = ('C:\nodejs;{0}' -f $env:PATH); \
48-
Write-Host ('Updating PATH: {0}' -f $newPath); \
49-
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); \
50-
# Because we need to use it in the current session
51-
$env:PATH = $newPath; \
17+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \
18+
Remove-Item node.zip -Force ; \
5219
node --version; \
5320
npm --version;
5421

55-
ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
56-
5722
CMD [ "node.exe" ]

docker-entrypoint.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

update.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ for version in "${versions[@]}"; do
269269
# Copy .sh only if not is_windows
270270
if ! is_windows "${variant}"; then
271271
cp "${parentpath}/docker-entrypoint.sh" "${version}/${variant}/docker-entrypoint.sh"
272-
elif is_windows "${variant}"; then
273-
cp "${parentpath}/docker-entrypoint.ps1" "${version}/${variant}/docker-entrypoint.ps1"
274272
fi
275273

276274
if [ "${update_version}" -eq 0 ] && [ "${update_variant}" -eq 0 ]; then

0 commit comments

Comments
 (0)