Skip to content

dockerfile: Windows Containers image Fluent Bit NMake build #10180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 21, 2025
29 changes: 12 additions & 17 deletions dockerfiles/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION AS builder-base

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install Visual Studio Build Tools 2019
# Install Visual Studio Build Tools 2019 (MSVS_VERSION=16) / 2022 (MSVS_VERSION=17, requires WINDOWS_VERSION=ltsc2022)
WORKDIR /local
ENV MSVS_BUILD_TOOLS_VERSION="16" `
ARG MSVS_VERSION="16"
ENV MSVS_BUILD_TOOLS_VERSION="$MSVS_VERSION" `
MSVS_BUILD_TOOLS_DOWNLOAD_URL="https://aka.ms/vs" `
MSVS_HOME="C:\BuildTools"
RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
Expand All @@ -43,17 +44,6 @@ RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
'--includeRecommended' -NoNewWindow -Wait; `
Remove-Item -Force \"${msvs_build_tools_dist}\";

ENV MSVC_RUNTIME_VERSION="15" `
MSVC_RUNTIME_DOWNLOAD_URL="https://aka.ms/vs"
RUN $msvc_runtime_dist_name=\"vc_redist.x64.exe\"; `
$msvc_runtime_dist=\"${env:TMP}\${msvc_runtime_dist_name}\"; `
$msvc_runtime_url=\"${env:MSVC_RUNTIME_DOWNLOAD_URL}/${env:MSVC_RUNTIME_VERSION}/release/${msvc_runtime_dist_name}\"; `
Write-Host \"Downloading Microsoft Visual C++ Redistributable...\"; `
Write-Host \"${msvc_runtime_url} -> ${msvc_runtime_dist}\"; `
Invoke-WebRequest -OutFile \"${msvc_runtime_dist}\" \"${msvc_runtime_url}\"; `
Write-Host \"Installing Microsoft Visual C++ runtime libraries...\"; `
Start-Process \"${msvc_runtime_dist}\" -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; `
Remove-Item -Force \"${msvc_runtime_dist}\";

ENV CMAKE_HOME="C:\cmake"
ARG CMAKE_VERSION="3.31.6"
Expand Down Expand Up @@ -164,17 +154,22 @@ WORKDIR /src/build
COPY . /src/

ARG BUILD_PARALLEL=1
RUN cmake -G "'Visual Studio 16 2019'" `
SHELL ["cmd", "/S", "/C"]
RUN call "%MSVS_HOME%\VC\Auxiliary\Build\vcvars64.bat" && `
cmake -G "NMake Makefiles" `
-DOPENSSL_ROOT_DIR='C:\dev\vcpkg\packages\openssl_x64-windows-static' `
-DFLB_LIBYAML_DIR='C:\dev\vcpkg\packages\libyaml_x64-windows-static' `
-DCMAKE_BUILD_TYPE=Release `
-DFLB_SHARED_LIB=Off `
-DFLB_EXAMPLES=Off `
-DFLB_DEBUG=Off `
-DFLB_RELEASE=On `
../;`
cmake --build . --config Release -j ${BUILD_PARALLEL};
..\ && `
cmake --build . --config Release -j "%BUILD_PARALLEL%"

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

WORKDIR /fluent-bit/bin
# Set up config files and binaries in single /fluent-bit hierarchy for easy copy in later stage
RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; `
Copy-Item -Path /src/conf/fluent-bit-win32.conf /fluent-bit/etc/fluent-bit.conf; `
Expand All @@ -185,7 +180,7 @@ RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; `
Copy-Item -Path /src/conf/parsers_openstack.conf /fluent-bit/etc/; `
Copy-Item -Path /src/conf/parsers_cinder.conf /fluent-bit/etc/; `
Copy-Item -Path /src/conf/plugins.conf /fluent-bit/etc/; `
Copy-Item -Path /src/build/bin/Release/fluent-bit.exe /fluent-bit/bin/;
Copy-Item -Path /src/build/bin/fluent-bit.exe /fluent-bit/bin/;

#
# Runtime Image - Windows Server Core
Expand Down
Loading