Skip to content

Commit d5e9215

Browse files
committed
Squash commits
1 parent 304b70f commit d5e9215

11 files changed

+405
-20
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: build-test-windows
2+
3+
on:
4+
push:
5+
paths:
6+
- "**/windows-2019/**"
7+
- "**/windows-2022/**"
8+
- ".github/workflows/build-test-windows.yml"
9+
10+
pull_request:
11+
paths:
12+
- "**/windows-2019/**"
13+
- "**/windows-2022/**"
14+
- ".github/workflows/build-test-windows.yml"
15+
16+
jobs:
17+
build-windows-2019:
18+
name: build-windows-2019
19+
runs-on: windows-2019
20+
timeout-minutes: 60
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
version: [ 22.7.0 ]
25+
variant: [ "windows-2019" ]
26+
27+
steps:
28+
- name: Get short node version
29+
uses: actions/github-script@v7
30+
id: short-version
31+
with:
32+
result-encoding: string
33+
script: return "${{ matrix.version }}".split('.')[0]
34+
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
# We cannot use docker/build-push-action here because it requires buildx, which is not available on Windows
39+
- name: Build image
40+
run: |
41+
docker build --tag node:${{ matrix.version }}-${{ matrix.variant }} ./${{ steps.short-version.outputs.result }}/${{ matrix.variant }}
42+
43+
- name: Test for node version
44+
shell: pwsh
45+
run: |
46+
$image_node_version = (docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} node --print "process.versions.node").Trim()
47+
Write-Host "Expected: '${{ matrix.version }}', Got: '$image_node_version'"
48+
if ($image_node_version -ne "${{ matrix.version }}") {
49+
exit 1
50+
}
51+
52+
- name: Verify entrypoint runs regular, non-executable files with node
53+
shell: pwsh
54+
run: |
55+
$tempDir = New-Item -ItemType Directory -Path $env:TEMP -Name "tempNodeApp"
56+
$tmp_file = Join-Path $tempDir "index.js"
57+
"console.log('success')" | Out-File -FilePath $tmp_file -Encoding utf8
58+
$output = (docker run --rm -w /app --mount "type=bind,src=$tempDir,target=c:\app" node:${{ matrix.version }}-${{ matrix.variant }} C:/app/index.js)
59+
if ($output -ne 'success') {
60+
Write-Host "Invalid"
61+
}
62+
63+
- name: Test for npm
64+
run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} npm --version
65+
66+
build-windows-2022:
67+
name: build-windows-2022
68+
runs-on: windows-2022
69+
timeout-minutes: 60
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
version: [ "22.7.0" ]
74+
variant: [ "windows-2022" ]
75+
76+
steps:
77+
- name: Get short node version
78+
uses: actions/github-script@v7
79+
id: short-version
80+
with:
81+
result-encoding: string
82+
script: return "${{ matrix.version }}".split('.')[0]
83+
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
87+
# We cannot use docker/build-push-action here because it requires buildx, which is not available on Windows
88+
- name: Build image
89+
run: |
90+
docker build --tag node:${{ matrix.version }}-${{ matrix.variant }} ./${{ steps.short-version.outputs.result }}/${{ matrix.variant }}
91+
92+
- name: Test for node version
93+
shell: pwsh
94+
run: |
95+
$image_node_version = (docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} node --print "process.versions.node").Trim()
96+
Write-Host "Expected: '${{ matrix.version }}', Got: '$image_node_version'"
97+
if ($image_node_version -ne "${{ matrix.version }}") {
98+
exit 1
99+
}
100+
101+
- name: Verify entrypoint runs regular, non-executable files with node
102+
shell: pwsh
103+
run: |
104+
$tempDir = New-Item -ItemType Directory -Path $env:TEMP -Name "tempNodeApp"
105+
$tmp_file = Join-Path $tempDir "index.js"
106+
"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)
108+
if ($output -ne 'success') {
109+
Write-Host "Invalid"
110+
}
111+
112+
- name: Test for npm
113+
run: docker run --rm node:${{ matrix.version }}-${{ matrix.variant }} npm --version

22/windows-2019/Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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:\Program Files (x86)\GnuPG\bin;{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:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
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:\nodejs;{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" ]

22/windows-2019/docker-entrypoint.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Ensure script stops on any error
2+
$ErrorActionPreference = 'Stop'
3+
4+
# Check if the first argument:
5+
# 1. Contains a "-"
6+
# 2. Is NOT a recognized command
7+
# 3. Is a file that's NOT executable
8+
if (($args[0] -like '*-') -or
9+
(!(Get-Command $args[0] -ErrorAction SilentlyContinue)) -or
10+
(((Test-Path $args[0] -PathType Leaf)) -and -not ((Get-Item $args[0]).Attributes -band 'ReadOnly'))) {
11+
# Prepend 'node' to the argument list
12+
$args = @('node') + $args
13+
}
14+
15+
# Execute the (potentially modified) command
16+
& $args[0] $args[1..($args.Length-1)]

22/windows-2022/Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM mcr.microsoft.com/windows/servercore:ltsc2022 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:\Program Files (x86)\GnuPG\bin;{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:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
44+
45+
FROM mcr.microsoft.com/windows/servercore:ltsc2022 as runner
46+
47+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
48+
49+
RUN $newPath = ('C:\nodejs;{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" ]

22/windows-2022/docker-entrypoint.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Ensure script stops on any error
2+
$ErrorActionPreference = 'Stop'
3+
4+
# Check if the first argument:
5+
# 1. Contains a "-"
6+
# 2. Is NOT a recognized command
7+
# 3. Is a file that's NOT executable
8+
if (($args[0] -like '*-') -or
9+
(!(Get-Command $args[0] -ErrorAction SilentlyContinue)) -or
10+
(((Test-Path $args[0] -PathType Leaf)) -and -not ((Get-Item $args[0]).Attributes -band 'ReadOnly'))) {
11+
# Prepend 'node' to the argument list
12+
$args = @('node') + $args
13+
}
14+
15+
# Execute the (potentially modified) command
16+
& $args[0] $args[1..($args.Length-1)]

Dockerfile-windows.template

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM mcr.microsoft.com/windows/servercore:version 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:\Program Files (x86)\GnuPG\bin;{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 0.0.0
12+
ENV NODE_CHECKSUM CHECKSUM_x64
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+
"${NODE_KEYS[@]}"
22+
) | foreach { \
23+
gpg --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
24+
} ; \
25+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
26+
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
27+
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
28+
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
29+
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
30+
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
31+
Expand-Archive node.zip -DestinationPath C:\ ; \
32+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
33+
34+
FROM mcr.microsoft.com/windows/servercore:version as runner
35+
36+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
37+
38+
RUN $newPath = ('C:\nodejs;{0}' -f $env:PATH); \
39+
Write-Host ('Updating PATH: {0}' -f $newPath); \
40+
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
41+
42+
COPY --from=installer C:/nodejs C:/nodejs
43+
44+
COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
45+
ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
46+
47+
# Smoke test
48+
RUN node --version; \
49+
npm --version;
50+
51+
CMD [ "node.exe" ]

architectures

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
bashbrew-arch variants
2-
amd64 alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim
2+
amd64 alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim,windows-2019,windows-2022
33
arm32v6 alpine3.19,alpine3.20
44
arm32v7 alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim
55
arm64v8 alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim
66
i386 alpine3.19,alpine3.20
77
ppc64le alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim
8-
s390x alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim
8+
s390x alpine3.19,alpine3.20,bookworm,bookworm-slim,bullseye,bullseye-slim

docker-entrypoint.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Ensure script stops on any error
2+
$ErrorActionPreference = 'Stop'
3+
4+
# Check if the first argument:
5+
# 1. Contains a "-"
6+
# 2. Is NOT a recognized command
7+
# 3. Is a file that's NOT executable
8+
if (($args[0] -like '*-') -or
9+
(!(Get-Command $args[0] -ErrorAction SilentlyContinue)) -or
10+
(((Test-Path $args[0] -PathType Leaf)) -and -not ((Get-Item $args[0]).Attributes -band 'ReadOnly'))) {
11+
# Prepend 'node' to the argument list
12+
$args = @('node') + $args
13+
}
14+
15+
# Execute the (potentially modified) command
16+
& $args[0] $args[1..($args.Length-1)]

functions.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ function is_debian_slim() {
193193
return 1
194194
}
195195

196+
function is_windows() {
197+
local variant
198+
variant=$1
199+
shift
200+
201+
if [ "${variant}" = "${variant#windows}" ]; then
202+
return 1
203+
fi
204+
}
205+
196206
function get_fork_name() {
197207
local version
198208
version=$1

0 commit comments

Comments
 (0)