11
11
# - dockerfiles/Dockerfile.windows
12
12
#
13
13
14
- ARG WINDOWS_VERSION=ltsc2019
14
+ ARG WINDOWS_VERSION=ltsc2025
15
15
16
16
# Builder Image - Windows Server Core
17
17
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION AS builder-base
18
18
19
19
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
20
20
21
+ # Clean up any existing temp files and create fresh temp directory
22
+ RUN Remove-Item -Path $env:TEMP\* -Recurse -Force -ErrorAction SilentlyContinue; `
23
+ Remove-Item -Path C:\Windows\Temp\* -Recurse -Force -ErrorAction SilentlyContinue; `
24
+ New-Item -ItemType Directory -Path $env:TEMP -Force -ErrorAction SilentlyContinue;
25
+
21
26
# Install Visual Studio Build Tools 2019 (MSVS_VERSION=16) / 2022 (MSVS_VERSION=17, requires WINDOWS_VERSION=ltsc2022)
22
27
WORKDIR /local
23
- ARG MSVS_VERSION="16 "
28
+ ARG MSVS_VERSION="17 "
24
29
ENV MSVS_BUILD_TOOLS_VERSION="$MSVS_VERSION" `
25
30
MSVS_BUILD_TOOLS_DOWNLOAD_URL="https://aka.ms/vs" `
26
31
MSVS_HOME="C:\BuildTools"
32
+
27
33
RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
28
34
$msvs_build_tools_dist=\"${env:TMP}\${msvs_build_tools_dist_name}\"; `
29
35
$msvs_build_tools_channel=\"C:\local\VisualStudio.chman\"; `
@@ -42,8 +48,8 @@ RUN $msvs_build_tools_dist_name=\"vs_buildtools.exe\"; `
42
48
\"--installChannelUri ${msvs_build_tools_channel}\", `
43
49
'--add Microsoft.VisualStudio.Workload.VCTools', `
44
50
'--includeRecommended' -NoNewWindow -Wait; `
45
- Remove-Item -Force \"${msvs_build_tools_dist}\";
46
-
51
+ Remove-Item -Force \"${msvs_build_tools_dist}\"; `
52
+ Remove-Item -Path \"${msvs_build_tools_channel}\" -Force;
47
53
48
54
ENV CMAKE_HOME="C:\cmake"
49
55
ARG CMAKE_VERSION="3.31.6"
@@ -98,7 +104,7 @@ RUN $win_flex_bison_dist_base_name=\"win_flex_bison-${env:WIN_FLEX_BISON_VERSION
98
104
Write-Host \"Copying...\"; `
99
105
Write-Host \"${env:WIN_FLEX_BISON_HOME}\win_flex.exe -> ${env:WIN_FLEX_BISON_HOME}\flex.exe\"; `
100
106
Copy-Item -Path \"${env:WIN_FLEX_BISON_HOME}\win_flex.exe\" \"${env:WIN_FLEX_BISON_HOME}\flex.exe\"; `
101
- $env:PATH=\"${env:PATH}${env:WIN_FLEX_BISON_HOME}\"; `
107
+ $env:PATH=\"${env:PATH}; ${env:WIN_FLEX_BISON_HOME}\"; `
102
108
Write-Host \"Setting PATH...\"; `
103
109
Write-Host \"${env:PATH}\"; `
104
110
[Environment]::SetEnvironmentVariable(\"PATH\", \"${env:PATH}\", [EnvironmentVariableTarget]::Machine);
@@ -127,7 +133,7 @@ RUN $vcpkg_dist_base_name=\"vcpkg-${env:VCPKG_VERSION}\"; `
127
133
Write-Host \"Moving vcpkg...\"; `
128
134
Write-Host \"${vcpkg_temp_dir} -> ${vcpkg_home_dir}\"; `
129
135
[System.IO.Directory]::Move(\"${vcpkg_temp_dir}\", \"${vcpkg_home_dir}\"); `
130
- $env:PATH=\"${env:PATH}${vcpkg_home_dir}\"; `
136
+ $env:PATH=\"${env:PATH}; ${vcpkg_home_dir}\"; `
131
137
Write-Host \"Setting PATH...\"; `
132
138
Write-Host \"${env:PATH}\"; `
133
139
[Environment]::SetEnvironmentVariable(\"PATH\", \"${env:PATH}\", [EnvironmentVariableTarget]::Machine); `
@@ -138,10 +144,14 @@ RUN $vcpkg_dist_base_name=\"vcpkg-${env:VCPKG_VERSION}\"; `
138
144
ENV VCPKG_BUILD_TYPE=release `
139
145
VCPKG_LIBRARY_LINKAGE=static
140
146
147
+ # Install dependencies with cleanup between each to save space
141
148
RUN vcpkg install --recurse openssl --triplet x64-windows-static; `
142
- vcpkg install --recurse libyaml --triplet x64-windows-static;
149
+ vcpkg cleanup;
150
+
151
+ RUN vcpkg install --recurse libyaml --triplet x64-windows-static; `
152
+ vcpkg cleanup;
143
153
144
- # Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile
154
+ # Copy required runtime libraries
145
155
WORKDIR /fluent-bit/bin
146
156
RUN Copy-Item -Path C:\Windows\System32\msvcp140.dll -Destination /fluent-bit/bin/; `
147
157
Copy-Item -Path C:\Windows\System32\vccorlib140.dll -Destination /fluent-bit/bin/; `
@@ -206,6 +216,7 @@ LABEL org.opencontainers.image.title="Fluent Bit" `
206
216
org.opencontainers.image.source="https://github.com/fluent/fluent-bit" `
207
217
org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION
208
218
219
+ # Copy only the built artifacts from builder stage
209
220
COPY --from=builder /fluent-bit /fluent-bit
210
221
211
222
RUN setx /M PATH "%PATH%;C:\fluent-bit\bin"
0 commit comments