Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor Author

@mabrarov mabrarov Jun 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVS_VERSION=17 (Visual Studio Build Tools 2022) can be used even with WINDOWS_VERSION=ltsc2019:

$ docker build -t fluent/fluent-bit --build-arg MSVS_VERSION=17 -f dockerfiles/Dockerfile.windows .
...
Downloading Visual Studio Build Tools...
https://aka.ms/vs/17/release/vs_buildtools.exe -> C:\Users\ContainerAdministrator\AppData\Local\Temp\vs_buildtools.exe
https://aka.ms/vs/17/release/channel -> C:\local\VisualStudio.chman
Installing Visual Studio Build Tools into C:\BuildTools...
...
Successfully tagged fluent/fluent-bit:latest
$ docker run --rm fluent/fluent-bit --version
Fluent Bit v4.0.4
...
$ docker run --rm --entrypoint cmd fluent/fluent-bit
Microsoft Windows [Version 10.0.17763.678]
(c) 2018 Microsoft Corporation. All rights reserved.
...

Moreover, GitHub actions for this repository use windows-latest runner (including test execution for pull requests) which hosts Visual Studio 2022. It means that CI/CD builds Fluent Bit for Windows on Windows Server 2022 using Visual C++ 2022, except Docker image for Windows.

Visual Studio 2022 supports Windows Server 2019 - refer to https://learn.microsoft.com/en-us/visualstudio/releases/2022/system-requirements#supported-operating-systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this comment in #10233

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