-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDockerfile-windows.template
More file actions
57 lines (44 loc) · 2.75 KB
/
Dockerfile-windows.template
File metadata and controls
57 lines (44 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM mcr.microsoft.com/windows/servercore:version as installer
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('C:\Program Files (x86)\GnuPG\bin;{0}' -f $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
# doing this first to share cache across versions more aggressively
ENV NODE_VERSION 0.0.0
ENV NODE_CHECKSUM CHECKSUM_x64
# Version and checksum of the GPG installer (Source: https://lists.gnupg.org/pipermail/gnupg-announce/2024q3/000484.html)
ENV GPG_VERSION 2.5.0_20240705
ENV GPG_CHECKSUM 35caef9965b10eed53b8d09b48fba5d1479f3512
RUN Invoke-WebRequest $('https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-{0}.exe' -f $env:GPG_VERSION) -OutFile 'gpg-installer.exe'; \
if ((Get-FileHash gpg-installer.exe -Algorithm sha1).Hash -ne $env:GPG_CHECKSUM) { Write-Error 'GPG checksum mismatch' }; \
Start-Process -FilePath 'gpg-installer.exe' -ArgumentList '/S' -Wait; \
gpg --version;
RUN @( \
"${NODE_KEYS[@]}"
) | foreach { \
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $_ ; \
if (-not $?) { \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys $_ ; \
} \
} ; \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/SHASUMS256.txt.asc' -f $env:NODE_VERSION) -OutFile 'SHASUMS256.txt.asc' -UseBasicParsing ; \
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc ; \
Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
$sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
Expand-Archive node.zip -DestinationPath C:\ ; \
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
FROM mcr.microsoft.com/windows/servercore:version as runner
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN $newPath = ('C:\nodejs;{0}' -f $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
COPY --from=installer C:/nodejs C:/nodejs
COPY docker-entrypoint.ps1 C:/docker-entrypoint.ps1
ENTRYPOINT [ "powershell.exe" , "C:/docker-entrypoint.ps1" ]
# Smoke test
RUN node --version; \
npm --version;
CMD [ "node.exe" ]