Skip to content

Commit 4e0288b

Browse files
Patscne59
authored andcommitted
windows: disable unused build targets and optimise container (fluent#10136)
* windows: disable unused build targets and optimise container Signed-off-by: Patrick Stephens <[email protected]>
1 parent 35675ad commit 4e0288b

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/call-build-images.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,26 @@ jobs:
401401
with:
402402
ref: ${{ inputs.ref }}
403403

404+
# - name: Set up Docker Buildx
405+
# uses: docker/setup-buildx-action@v3
406+
404407
- name: Log in to the Container registry
405408
uses: docker/login-action@v3
406409
with:
407410
registry: ${{ inputs.registry }}
408411
username: ${{ inputs.username }}
409412
password: ${{ secrets.token }}
410413

414+
- name: Pull the last release image to speed up the build with a cache
415+
continue-on-error: true
416+
run: |
417+
VERSION=$(gh release list --json tagName,isLatest --jq '.[] | select(.isLatest)|.tagName | sub("^v"; "")')
418+
echo VERSION="$VERSION"
419+
docker pull ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-$VERSION
420+
shell: bash
421+
env:
422+
GH_TOKEN: ${{ secrets.token }}
423+
411424
- name: Build the production images
412425
run: |
413426
docker build -t ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-${{ inputs.version }} --build-arg FLB_NIGHTLY_BUILD=${{ inputs.unstable }} --build-arg WINDOWS_VERSION=ltsc${{ matrix.windows-base-version }} -f ./dockerfiles/Dockerfile.windows .

dockerfiles/Dockerfile.windows

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
ARG WINDOWS_VERSION=ltsc2019
1515

1616
# Builder Image - Windows Server Core
17-
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION AS builder
17+
FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION AS builder-base
1818

1919
RUN setx /M PATH "%PATH%;C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\WinFlexBison;C:\dev\vcpkg"
2020

@@ -62,15 +62,29 @@ RUN `
6262
Rename-Item -Path /dev/vcpkg-${ENV:VCPKG_VERSION} -NewName vcpkg; `
6363
/dev/vcpkg/bootstrap-vcpkg.bat;
6464

65+
# Ensure we only attempt to build release and static linking
66+
ENV VCPKG_BUILD_TYPE=release
67+
ENV VCPKG_LIBRARY_LINKAGE=static
68+
6569
RUN vcpkg install --recurse openssl --triplet x64-windows-static; `
6670
vcpkg install --recurse libyaml --triplet x64-windows-static;
6771

72+
FROM builder-base AS builder
73+
6874
# Build Fluent Bit from source - context must be the root of the Git repo
6975
WORKDIR /src/build
7076
COPY . /src/
7177

7278
ARG BUILD_PARALLEL=1
73-
RUN cmake -G "'Visual Studio 16 2019'" -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 ../;`
79+
RUN cmake -G "'Visual Studio 16 2019'" `
80+
-DOPENSSL_ROOT_DIR='C:\dev\vcpkg\packages\openssl_x64-windows-static' `
81+
-DFLB_LIBYAML_DIR='C:\dev\vcpkg\packages\libyaml_x64-windows-static' `
82+
-DCMAKE_BUILD_TYPE=Release `
83+
-DFLB_SHARED_LIB=Off `
84+
-DFLB_EXAMPLES=Off `
85+
-DFLB_DEBUG=Off `
86+
-DFLB_RELEASE=On `
87+
../;`
7488
cmake --build . --config Release -j ${BUILD_PARALLEL};
7589

7690
# Set up config files and binaries in single /fluent-bit hierarchy for easy copy in later stage
@@ -83,8 +97,8 @@ RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; `
8397
Copy-Item -Path /src/conf/parsers_openstack.conf /fluent-bit/etc/; `
8498
Copy-Item -Path /src/conf/parsers_cinder.conf /fluent-bit/etc/; `
8599
Copy-Item -Path /src/conf/plugins.conf /fluent-bit/etc/; `
86-
Copy-Item -Path /src/build/bin/Release/fluent-bit.exe /fluent-bit/bin/; `
87-
Copy-Item -Path /src/build/bin/Release/fluent-bit.dll /fluent-bit/bin/;
100+
Copy-Item -Path /src/build/bin/Release/fluent-bit.exe /fluent-bit/bin/;
101+
88102
#
89103
# Runtime Image - Windows Server Core
90104
#

0 commit comments

Comments
 (0)