@@ -18,9 +18,10 @@ FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION AS builder-base
1818
1919SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
2020
21- # Install Visual Studio Build Tools 2019
21+ # Install Visual Studio Build Tools 2019 (MSVS_VERSION=16) / 2022 (MSVS_VERSION=17, requires WINDOWS_VERSION=ltsc2022)
2222WORKDIR /local
23- ENV MSVS_BUILD_TOOLS_VERSION="16" `
23+ ARG MSVS_VERSION="16"
24+ ENV MSVS_BUILD_TOOLS_VERSION="$MSVS_VERSION" `
2425 MSVS_BUILD_TOOLS_DOWNLOAD_URL="https://aka.ms/vs" `
2526 MSVS_HOME="C:\BuildTools"
2627RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
@@ -43,17 +44,6 @@ RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
4344 '--includeRecommended' -NoNewWindow -Wait; `
4445 Remove-Item -Force \"${msvs_build_tools_dist}\";
4546
46- ENV MSVC_RUNTIME_VERSION="15" `
47- MSVC_RUNTIME_DOWNLOAD_URL="https://aka.ms/vs"
48- RUN $msvc_runtime_dist_name=\"vc_redist.x64.exe\"; `
49- $msvc_runtime_dist=\"${env:TMP}\${msvc_runtime_dist_name}\"; `
50- $msvc_runtime_url=\"${env:MSVC_RUNTIME_DOWNLOAD_URL}/${env:MSVC_RUNTIME_VERSION}/release/${msvc_runtime_dist_name}\"; `
51- Write-Host \"Downloading Microsoft Visual C++ Redistributable...\"; `
52- Write-Host \"${msvc_runtime_url} -> ${msvc_runtime_dist}\"; `
53- Invoke-WebRequest -OutFile \"${msvc_runtime_dist}\" \"${msvc_runtime_url}\"; `
54- Write-Host \"Installing Microsoft Visual C++ runtime libraries...\"; `
55- Start-Process \"${msvc_runtime_dist}\" -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; `
56- Remove-Item -Force \"${msvc_runtime_dist}\";
5747
5848ENV CMAKE_HOME="C:\cmake"
5949ARG CMAKE_VERSION="3.31.6"
@@ -164,17 +154,22 @@ WORKDIR /src/build
164154COPY . /src/
165155
166156ARG BUILD_PARALLEL=1
167- RUN cmake -G "'Visual Studio 16 2019'" `
157+ SHELL ["cmd", "/S", "/C"]
158+ RUN call "%MSVS_HOME%\VC\Auxiliary\Build\vcvars64.bat" && `
159+ cmake -G "NMake Makefiles" `
168160 -DOPENSSL_ROOT_DIR='C:\dev\vcpkg\packages\openssl_x64-windows-static' `
169161 -DFLB_LIBYAML_DIR='C:\dev\vcpkg\packages\libyaml_x64-windows-static' `
170162 -DCMAKE_BUILD_TYPE=Release `
171163 -DFLB_SHARED_LIB=Off `
172164 -DFLB_EXAMPLES=Off `
173165 -DFLB_DEBUG=Off `
174166 -DFLB_RELEASE=On `
175- ../; `
176- cmake --build . --config Release -j ${ BUILD_PARALLEL};
167+ ..\ && `
168+ cmake --build . --config Release -j "% BUILD_PARALLEL%"
177169
170+ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
171+
172+ WORKDIR /fluent-bit/bin
178173# Set up config files and binaries in single /fluent-bit hierarchy for easy copy in later stage
179174RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; `
180175 Copy-Item -Path /src/conf/fluent-bit-win32.conf /fluent-bit/etc/fluent-bit.conf; `
@@ -185,7 +180,7 @@ RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; `
185180 Copy-Item -Path /src/conf/parsers_openstack.conf /fluent-bit/etc/; `
186181 Copy-Item -Path /src/conf/parsers_cinder.conf /fluent-bit/etc/; `
187182 Copy-Item -Path /src/conf/plugins.conf /fluent-bit/etc/; `
188- Copy-Item -Path /src/build/bin/Release/ fluent-bit.exe /fluent-bit/bin/;
183+ Copy-Item -Path /src/build/bin/fluent-bit.exe /fluent-bit/bin/;
189184
190185#
191186# Runtime Image - Windows Server Core
0 commit comments