From cc8145e86158fb805d4cac1f71d3a9b79ee3f858 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Thu, 6 Jun 2024 19:55:53 +0900 Subject: [PATCH] dockerfiles: windows: Update to use vcpkg instead of chocolatey Signed-off-by: Hiroshi Hatake --- dockerfiles/Dockerfile.windows | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dockerfiles/Dockerfile.windows b/dockerfiles/Dockerfile.windows index 71228821691..39147d4f1bf 100644 --- a/dockerfiles/Dockerfile.windows +++ b/dockerfiles/Dockerfile.windows @@ -16,7 +16,7 @@ ARG WINDOWS_VERSION=ltsc2019 # Builder Image - Windows Server Core FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder -RUN setx /M PATH "%PATH%;C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\WinFlexBison" +RUN setx /M PATH "%PATH%;C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\WinFlexBison;C:\dev\vcpkg" SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] WORKDIR /local @@ -49,18 +49,24 @@ RUN Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', ' Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; ` Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/; -# Install Chocolatey and OpenSSL: https://github.com/StefanScherer/dockerfiles-windows/blob/main/openssl/Dockerfile -ENV chocolateyUseWindowsCompression false -ENV chocolateyVersion '1.4.0' -RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); ` - choco feature disable --name showDownloadProgress ; ` - choco install -y openssl; +ARG VCPKG_VERSION=2024.05.24 +# https://github.com/microsoft/vcpkg/blob/2024.05.24/scripts/bootstrap.ps1 +ARG VCPKG_TOOL_RELEASE_TAG=2024-04-23 + +WORKDIR C:/dev/ + +RUN ` + pwsh -command "Invoke-WebRequest -OutFile C:\dev\vcpkg.zip https://github.com/microsoft/vcpkg/archive/refs/tags/%VCPKG_VERSION%.zip" ` + && tar -xf C:\dev\vcpkg.zip ` + && del /q c:\dev\vcpkg.zip ` + && ren vcpkg-%VCPKG_VERSION% vcpkg ` + && pwsh -command "Invoke-WebRequest -OutFile vcpkg/vcpkg.exe https://github.com/microsoft/vcpkg-tool/releases/download/%VCPKG_TOOL_RELEASE_TAG%/vcpkg.exe"; # Build Fluent Bit from source - context must be the root of the Git repo WORKDIR /src/build COPY . /src/ -RUN cmake -G "'Visual Studio 16 2019'" -DOPENSSL_ROOT_DIR='C:\Program Files\OpenSSL-Win64\lib\VC\x64\MT' -DOPENSSL_INCLUDE_DIR='C:\Program Files\OpenSSL-Win64\include' -DCMAKE_BUILD_TYPE=Release ../;` +RUN cmake -G "'Visual Studio 16 2019'" -DOPENSSL_ROOT_DIR='C:\dev\packages\openssl_x64-windows-static' -DFLB_LIBYAML_DIR='C:\dev\packages\libyaml_x64-windows-static' -DCMAKE_BUILD_TYPE=Release ../;` cmake --build . --config Release; # Set up config files and binaries in single /fluent-bit hierarchy for easy copy in later stage