-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathDockerfile
More file actions
197 lines (174 loc) · 10.3 KB
/
Copy pathDockerfile
File metadata and controls
197 lines (174 loc) · 10.3 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# escape=`
ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2022
FROM ${BASE_IMAGE}
ARG SOURCE_DATE_EPOCH
ARG DD_TARGET_ARCH=x64
ENV SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}
ENV DD_TARGET_ARCH=${DD_TARGET_ARCH}
SHELL ["cmd", "/S", "/C"]
# https://learn.microsoft.com/en-us/visualstudio/install/build-tools-container#create-and-build-the-dockerfile
# https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools
# Bootstrapper version pinned to 17.12.36227.10 (taken from learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#fixed-version-bootstrappers)
RUN curl -SL --output vs_buildtools.exe https://download.visualstudio.microsoft.com/download/pr/87b94407-0aa3-45fc-b53f-d224027a42b3/00e8cad9ef34839c57f9be8bc4f93c517804777bdef770e8dbdc8ba0e06bc348/vs_BuildTools.exe `
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
--add Microsoft.VisualStudio.Component.VC.140 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK.20348 `
--add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 `
--add Microsoft.VisualStudio.Workload.VCTools `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) `
&& del /q vs_buildtools.exe
ENV VCVARSALL_BAT="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
# Upgrade PowerShell
ENV POWERSHELL_VERSION="7.4.0"
RUN curl -SL --output PowerShell-%POWERSHELL_VERSION%-win-x64.msi https://github.com/PowerShell/PowerShell/releases/download/v%POWERSHELL_VERSION%/PowerShell-%POWERSHELL_VERSION%-win-x64.msi `
&& powershell -Command Start-Process -Wait -FilePath msiexec -ArgumentList '/i', PowerShell-%POWERSHELL_VERSION%-win-x64.msi, '/quiet', '/norestart' `
&& del /q PowerShell-%POWERSHELL_VERSION%-win-x64.msi
COPY helpers.ps1 C:\helpers.ps1
SHELL ["pwsh", "-Command", ". C:\\helpers.ps1;"]
# Enable long paths
# https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#registry-setting-to-enable-long-paths
RUN New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
# Reduce the chance of hitting path limits (the MSVC compiler cl.exe doesn't seem to respect that optioin)
# This variable is honored by pip
ENV TMP="C:\tmp" `
TEMP="C:\tmp"
# Install 7-Zip ZS
ENV 7ZIP_VERSION="22.01" `
7ZIP_ZS_VERSION="1.5.5-R3"
RUN Get-RemoteFile `
-Uri https://github.com/mcmilk/7-Zip-zstd/releases/download/v$Env:7ZIP_VERSION-v$Env:7ZIP_ZS_VERSION/7z$Env:7ZIP_VERSION-zstd-x64.exe `
-Path 7z$Env:7ZIP_VERSION-zstd-x64.exe `
-Hash 'D542D78397BBED8E77C221F36CAD461A0D83F1263B993A7048E81DF40F403FB8'; `
Start-Process -Wait 7z$Env:7ZIP_VERSION-zstd-x64.exe -ArgumentList '/S'; `
Remove-Item 7z$Env:7ZIP_VERSION-zstd-x64.exe; `
Add-ToPath -Append 'C:\Program Files\7-Zip-Zstandard'
# Install Git
ENV GIT_VERSION="2.43.0" `
GIT_VERSION_TAG="2.43.0.windows.1"
RUN Get-RemoteFile `
-Uri https://github.com/git-for-windows/git/releases/download/v$Env:GIT_VERSION_TAG/MinGit-$Env:GIT_VERSION-64-bit.zip `
-Path MinGit-$Env:GIT_VERSION-64-bit.zip `
-Hash '1905d93068e986258fafc69517df8fddff829bb2a289c1fa4dcc6cdf720ddf36'; `
$null = mkdir C:\devtools\git; `
7z x MinGit-$Env:GIT_VERSION-64-bit.zip -oC:\devtools\git; `
Remove-Item MinGit-$Env:GIT_VERSION-64-bit.zip; `
Add-ToPath -Append 'C:\devtools\git\cmd;C:\devtools\git\usr\bin'; `
git config --global user.name 'Agent Integrations Builder'; `
git config --global user.email 'agent-integrations-builder@datadoghq.com'
# Install Rust
ENV RUST_VERSION="1.91.0" `
RUSTUP_VERSION="1.26.0" `
RUSTC_HASH="365d072ac4ef47f8774f4d2094108035e2291a0073702db25fa7797a30861fc9"
RUN Get-RemoteFile `
-Uri https://static.rust-lang.org/rustup/archive/$Env:RUSTUP_VERSION/x86_64-pc-windows-msvc/rustup-init.exe `
-Path rustup-init.exe `
-Hash $Env:RUSTC_HASH; `
.\rustup-init.exe -y --profile minimal --default-toolchain $Env:RUST_VERSION; `
Remove-Item rustup-init.exe; `
Approve-File -Path $($Env:USERPROFILE + '\.cargo\bin\rustc.exe') -Hash $Env:RUSTC_HASH
# Install Python 3
ENV PYTHON_VERSION="3.13.15"
RUN Get-RemoteFile `
-Uri https://www.python.org/ftp/python/$Env:PYTHON_VERSION/python-$Env:PYTHON_VERSION-amd64.exe `
-Path python-$Env:PYTHON_VERSION-amd64.exe `
-Hash 'edec09c4853aeae9ac36efb8c9f95b6b8e2fee65eee56d9767a8b7c69c574403'; `
Start-Process -Wait python-$Env:PYTHON_VERSION-amd64.exe -ArgumentList '/quiet', 'InstallAllUsers=1'; `
Remove-Item python-$Env:PYTHON_VERSION-amd64.exe; `
& 'C:\Program Files\Python313\python.exe' -m pip install --no-warn-script-location --upgrade pip; `
& 'C:\Program Files\Python313\python.exe' -m pip install --no-warn-script-location virtualenv; `
& 'C:\Program Files\Python313\python.exe' -m virtualenv 'C:\py3'; `
Add-ToPath -Append 'C:\Program Files\Python313'
# Install IBM MQ
ENV IBM_MQ_VERSION="9.2.4.0"
RUN Get-RemoteFile `
-Uri https://s3.amazonaws.com/dd-agent-omnibus/ibm-mq-backup/$Env:IBM_MQ_VERSION-IBM-MQC-Redist-Win64.zip `
-Path $Env:IBM_MQ_VERSION-IBM-MQC-Redist-Win64.zip `
-Hash '9cea7e1693d051437e78468fd5e915b7b7ed2baf36cdae4936bcf2b760f55daa'; `
7z x $Env:IBM_MQ_VERSION-IBM-MQC-Redist-Win64.zip -oC:\ibm_mq; `
Remove-Item $Env:IBM_MQ_VERSION-IBM-MQC-Redist-Win64.zip; `
setx /M MQ_FILE_PATH 'C:\ibm_mq'
# Perl
ENV PERL_VERSION="5.40.0.1"
RUN Get-RemoteFile `
-Uri https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_54001_64bit_UCRT/strawberry-perl-$Env:PERL_VERSION-64bit-portable.zip `
-Path "strawberry-perl-$Env:PERL_VERSION-64bit.zip" `
-Hash '754f3e2a8e473dc68d1540c7802fb166a025f35ef18960c4564a31f8b5933907' && `
7z x "strawberry-perl-$Env:PERL_VERSION-64bit.zip" -o"C:\perl" && `
Add-ToPath -Append "C:\perl\perl\bin" && `
Remove-Item "strawberry-perl-$Env:PERL_VERSION-64bit.zip"
# Nasm
ENV NASM_VERSION="2.16.03"
RUN Get-RemoteFile `
-Uri https://www.nasm.us/pub/nasm/releasebuilds/$Env:NASM_VERSION/win64/nasm-$Env:NASM_VERSION-win64.zip `
-Path "nasm-$Env:NASM_VERSION-win64.zip" `
-Hash '3ee4782247bcb874378d02f7eab4e294a84d3d15f3f6ee2de2f47a46aa7226e6' && `
7z x "nasm-$Env:NASM_VERSION-win64.zip" -o"C:\nasm" && `
Add-ToPath -Append "C:\nasm\nasm-$Env:NASM_VERSION" && `
Remove-Item "nasm-$Env:NASM_VERSION-win64.zip"
ENV OPENSSL_VERSION="3.6.3"
RUN Get-RemoteFile `
-Uri https://www.openssl.org/source/openssl-$Env:OPENSSL_VERSION.tar.gz `
-Path openssl-$Env:OPENSSL_VERSION.tar.gz `
-Hash '243a86649cf6f23eeb6a2ff2456e09e5d77dd9018a54d3d96b0c6bdd6ba6c7f1'; `
7z x openssl-$Env:OPENSSL_VERSION.tar.gz -r -y && `
7z x openssl-$Env:OPENSSL_VERSION.tar -oC:\openssl_3 && `
cd C:\openssl_3\openssl-$Env:OPENSSL_VERSION && `
RunOnVSConsole -Command `
'C:\perl\perl\bin\perl.exe Configure && `
nmake && `
nmake install_sw'
# flex and bison are required for building PostgreSQL from source
ENV WINFLEXBISON_VERSION="2.5.25"
RUN Get-RemoteFile `
-Uri https://github.com/lexxmark/winflexbison/releases/download/v$Env:WINFLEXBISON_VERSION/win_flex_bison-$Env:WINFLEXBISON_VERSION.zip `
-Path win_flex_bison-$Env:WINFLEXBISON_VERSION.zip `
-Hash '8d324b62be33604b2c45ad1dd34ab93d722534448f55a16ca7292de32b6ac135'; `
7z x win_flex_bison-$Env:WINFLEXBISON_VERSION.zip -oC:\winflexbison && `
Remove-Item win_flex_bison-$Env:WINFLEXBISON_VERSION.zip && `
Add-ToPath -Append 'C:\winflexbison'
# Meson + Ninja for building PostgreSQL 18+ on Windows
# renovate: datasource=pypi depName=meson
ENV MESON_VERSION="1.11.1"
# renovate: datasource=pypi depName=ninja
ENV NINJA_VERSION="1.13.0"
RUN python -m pip install --no-warn-script-location meson==$Env:MESON_VERSION ninja==$Env:NINJA_VERSION && `
Add-ToPath -Append 'C:\Program Files\Python313\Scripts'
# libpq and pg_config as needed by psycopg
ENV PG_VERSION="18.3"
RUN Get-RemoteFile `
-Uri https://ftp.postgresql.org/pub/source/v$Env:PG_VERSION/postgresql-$Env:PG_VERSION.tar.bz2 `
-Path postgresql-$Env:PG_VERSION.tar.bz2 `
-Hash 'd95663fbbf3a80f81a9d98d895266bdcb74ba274bcc04ef6d76630a72dee016f'; `
7z x postgresql-$Env:PG_VERSION.tar.bz2 -r -y && `
7z x postgresql-$Env:PG_VERSION.tar -oC:\postgresql_src
RUN New-Item -ItemType Junction -Path C:\OpenSSL -Target 'C:\Program Files\OpenSSL'; `
$mesonCmd = 'meson setup C:\pgbuild C:\postgresql_src\postgresql-' + $Env:PG_VERSION + ' --prefix=C:\postgresql -Dssl=openssl -Dextra_include_dirs=C:\OpenSSL\include -Dextra_lib_dirs=C:\OpenSSL\lib -Dgssapi=disabled -Dreadline=disabled -Dicu=disabled -Dnls=disabled -Dlz4=disabled -Dzstd=disabled -Dlibxml=disabled -Dlibxslt=disabled -Dllvm=disabled'; `
RunOnVSConsole -Command $mesonCmd && `
RunOnVSConsole -Command 'ninja -C C:\pgbuild' && `
RunOnVSConsole -Command 'ninja -C C:\pgbuild install' && `
Add-ToPath -Append "C:\postgresql\bin"
ENV CURL_VERSION="8.21.0"
# Set up runner
COPY runner_dependencies.txt C:\runner_dependencies.txt
RUN python -m pip install --no-warn-script-location -r C:\runner_dependencies.txt
COPY build_script.ps1 C:\build_script.ps1
COPY update_librdkafka_manifest.py C:\update_librdkafka_manifest.py
ENV DD_BUILD_COMMAND="pwsh C:\build_script.ps1"
# Python packages that we want to build regardless of whether prebuilt versions exist on PyPI
ENV PIP_NO_BINARY="confluent_kafka"
# Where to find native dependencies when building extensions and for wheel repairing
RUN New-Item -Path "C:\include" -ItemType Directory
RUN New-Item -Path "C:\lib" -ItemType Directory
RUN New-Item -Path "C:\bin" -ItemType Directory
ENV INCLUDE="C:\include"
ENV LIB="C:\lib"
RUN Add-ToPath -Append "C:\bin"
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# This entry point starts the developer command prompt and launches PowerShell.
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "%DD_TARGET_ARCH%", "&&", "python", "C:\\mnt\\scripts\\build_wheels.py"]