diff --git a/Dockerfile.windows b/Dockerfile.windows index 1b7afef..02b4188 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -2,7 +2,7 @@ ARG FLUENTBIT_VERSION=3.2.2 ARG WINDOWS_VERSION=ltsc2019 - +ARG FLUENBIT_IMAGE_WINDOWS_SERVER_VERSION=windows-2019 ################################################# # Build New Relic Fluent Bit Output Plugin ################################################# @@ -63,148 +63,149 @@ RUN go build -buildmode=c-shared -o out_newrelic.dll . # which we mostly reuse below to build our own image containing Fluent Bit for Windows + New Relic Fluent Bit plugin # Builder Image - Windows Server Core (copied from Fluent Bit's official Dockerfile.windows file) -FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder - -ARG FLUENTBIT_VERSION - -# This line was added because chocolatey version 2.0 was released and it depends on .NET 4.8 -# We can update this with the approach that fluent-bit takes but at the moment of doing this change -# the fluent-bit image is not updated (and not working anymore) -ENV chocolateyVersion 1.4.0 - -# Install Chocolatey -RUN powershell.exe Invoke-WebRequest ` - -Uri https://chocolatey.org/install.ps1 ` - -OutFile C:\chocolatey-install.ps1 -RUN powershell.exe ` - -ExecutionPolicy bypass ` - -InputFormat none ` - -NoProfile ` - C:\chocolatey-install.ps1 -RUN setx PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" - -# Install Git -RUN choco install --yes --no-progress git - -# FluentBit's Dockerfile.windows is based on the assumption that the pipeline building it does -# a clone of the source repository previously to the build. -RUN git clone -b v%FLUENTBIT_VERSION% https://github.com/fluent/fluent-bit /src -RUN echo Cloned branch v%FLUENTBIT_VERSION% - -# -------------------------------------------------------------------------------------------------------------# -# # -# The following contents are copied from the original Fluent Bit repository, except: # -# - The FROM for the builder is specified above, so we can install Git and download # -# the source code prior to the build. # -# - Comment out the COPY as in the official Fluent Bit pipeline the source code is cloned externally # -# - At the very last step, we build and copy the New Relic plugin inside the resulting runtime image # -# -------------------------------------------------------------------------------------------------------------# - -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 - -# Install Visual Studio 2019 -ADD https://aka.ms/vs/16/release/vs_buildtools.exe /local/vs_buildtools.exe -ADD https://aka.ms/vs/16/release/channel /local/VisualStudio.chman - -RUN Start-Process /local/vs_buildtools.exe ` - -ArgumentList '--quiet ', '--wait ', '--norestart ', '--nocache', ` - '--installPath C:\BuildTools', ` - '--channelUri C:\local\VisualStudio.chman', ` - '--installChannelUri C:\local\VisualStudio.chman', ` - '--add Microsoft.VisualStudio.Workload.VCTools', ` - '--includeRecommended' -NoNewWindow -Wait; - -ADD https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip /local/win_flex_bison.zip - -RUN Expand-Archive /local/win_flex_bison.zip -Destination /WinFlexBison; ` - Copy-Item -Path /WinFlexBison/win_bison.exe /WinFlexBison/bison.exe; ` - Copy-Item -Path /WinFlexBison/win_flex.exe /WinFlexBison/flex.exe; - -# Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile -WORKDIR /local -ADD https://aka.ms/vs/15/release/vc_redist.x64.exe /local/vc_redist.x64.exe - -WORKDIR /fluent-bit/bin/ -RUN Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; ` - Copy-Item -Path /Windows/System32/msvcp140.dll -Destination /fluent-bit/bin/; ` - Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; ` - Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/; - -ENV VCPKG_VERSION=2024.05.24 -# https://github.com/microsoft/vcpkg/blob/2024.05.24/scripts/bootstrap.ps1 -ENV VCPKG_ROOT=/dev/vcpkg - -WORKDIR /dev - -RUN ` - Invoke-WebRequest -OutFile /dev/vcpkg.zip https://github.com/microsoft/vcpkg/archive/refs/tags/${ENV:VCPKG_VERSION}.zip; ` - Expand-Archive /dev/vcpkg.zip -Destination /dev; ` - Remove-Item -Force /dev/vcpkg.zip; ` - Rename-Item -Path /dev/vcpkg-${ENV:VCPKG_VERSION} -NewName vcpkg; ` - /dev/vcpkg/bootstrap-vcpkg.bat; - -RUN vcpkg install --recurse openssl --triplet x64-windows-static; ` - vcpkg install --recurse libyaml --triplet x64-windows-static; - - - -# Install Chocolatey and OpenSSL: https://github.com/StefanScherer/dockerfiles-windows/blob/main/openssl/Dockerfile -ENV chocolateyUseWindowsCompression=false -RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); ` - choco feature disable --name showDownloadProgress ; - # choco install -y openssl; +# FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder + +# ARG FLUENTBIT_VERSION + +# # This line was added because chocolatey version 2.0 was released and it depends on .NET 4.8 +# # We can update this with the approach that fluent-bit takes but at the moment of doing this change +# # the fluent-bit image is not updated (and not working anymore) +# ENV chocolateyVersion 1.4.0 + +# # Install Chocolatey +# RUN powershell.exe Invoke-WebRequest ` +# -Uri https://chocolatey.org/install.ps1 ` +# -OutFile C:\chocolatey-install.ps1 +# RUN powershell.exe ` +# -ExecutionPolicy bypass ` +# -InputFormat none ` +# -NoProfile ` +# C:\chocolatey-install.ps1 +# RUN setx PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" + +# # Install Git +# RUN choco install --yes --no-progress git + +# # FluentBit's Dockerfile.windows is based on the assumption that the pipeline building it does +# # a clone of the source repository previously to the build. +# RUN git clone -b v%FLUENTBIT_VERSION% https://github.com/fluent/fluent-bit /src +# RUN echo Cloned branch v%FLUENTBIT_VERSION% + +# # -------------------------------------------------------------------------------------------------------------# +# # # +# # The following contents are copied from the original Fluent Bit repository, except: # +# # - The FROM for the builder is specified above, so we can install Git and download # +# # the source code prior to the build. # +# # - Comment out the COPY as in the official Fluent Bit pipeline the source code is cloned externally # +# # - At the very last step, we build and copy the New Relic plugin inside the resulting runtime image # +# # -------------------------------------------------------------------------------------------------------------# + +# 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 + +# # Install Visual Studio 2019 +# ADD https://aka.ms/vs/16/release/vs_buildtools.exe /local/vs_buildtools.exe +# ADD https://aka.ms/vs/16/release/channel /local/VisualStudio.chman + +# RUN Start-Process /local/vs_buildtools.exe ` +# -ArgumentList '--quiet ', '--wait ', '--norestart ', '--nocache', ` +# '--installPath C:\BuildTools', ` +# '--channelUri C:\local\VisualStudio.chman', ` +# '--installChannelUri C:\local\VisualStudio.chman', ` +# '--add Microsoft.VisualStudio.Workload.VCTools', ` +# '--includeRecommended' -NoNewWindow -Wait; + +# ADD https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip /local/win_flex_bison.zip + +# RUN Expand-Archive /local/win_flex_bison.zip -Destination /WinFlexBison; ` +# Copy-Item -Path /WinFlexBison/win_bison.exe /WinFlexBison/bison.exe; ` +# Copy-Item -Path /WinFlexBison/win_flex.exe /WinFlexBison/flex.exe; + +# # Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile +# WORKDIR /local +# ADD https://aka.ms/vs/15/release/vc_redist.x64.exe /local/vc_redist.x64.exe + +# WORKDIR /fluent-bit/bin/ +# RUN Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; ` +# Copy-Item -Path /Windows/System32/msvcp140.dll -Destination /fluent-bit/bin/; ` +# Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; ` +# Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/; + +# ENV VCPKG_VERSION=2024.05.24 +# # https://github.com/microsoft/vcpkg/blob/2024.05.24/scripts/bootstrap.ps1 +# ENV VCPKG_ROOT=/dev/vcpkg + +# WORKDIR /dev + +# RUN ` +# Invoke-WebRequest -OutFile /dev/vcpkg.zip https://github.com/microsoft/vcpkg/archive/refs/tags/${ENV:VCPKG_VERSION}.zip; ` +# Expand-Archive /dev/vcpkg.zip -Destination /dev; ` +# Remove-Item -Force /dev/vcpkg.zip; ` +# Rename-Item -Path /dev/vcpkg-${ENV:VCPKG_VERSION} -NewName vcpkg; ` +# /dev/vcpkg/bootstrap-vcpkg.bat; + +# RUN vcpkg install --recurse openssl --triplet x64-windows-static; ` +# vcpkg install --recurse libyaml --triplet x64-windows-static; + + + +# # Install Chocolatey and OpenSSL: https://github.com/StefanScherer/dockerfiles-windows/blob/main/openssl/Dockerfile +# ENV chocolateyUseWindowsCompression false +# RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); ` +# choco feature disable --name showDownloadProgress ; +# # choco install -y openssl; -# 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:\dev\vcpkg\packages\openssl_x64-windows-static' -DFLB_LIBYAML_DIR='C:\dev\vcpkg\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 -RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; ` - Copy-Item -Path /src/conf/fluent-bit-win32.conf /fluent-bit/etc/fluent-bit.conf; ` - Copy-Item -Path /src/conf/parsers.conf /fluent-bit/etc/; ` - Copy-Item -Path /src/conf/parsers_ambassador.conf /fluent-bit/etc/; ` - Copy-Item -Path /src/conf/parsers_java.conf /fluent-bit/etc/; ` - Copy-Item -Path /src/conf/parsers_extra.conf /fluent-bit/etc/; ` - 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/Release/fluent-bit.dll /fluent-bit/bin/; -# -# Runtime Image - Windows Server Core -# -FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as runtime - -ARG FLUENTBIT_VERSION -ARG IMAGE_CREATE_DATE -ARG IMAGE_SOURCE_REVISION - -# Metadata as defined in OCI image spec annotations -# https://github.com/opencontainers/image-spec/blob/master/annotations.md -LABEL org.opencontainers.image.title="Fluent Bit" ` - org.opencontainers.image.description="Fluent Bit is an open source and multi-platform Log Processor and Forwarder which allows you to collect data/logs from different sources, unify and send them to multiple destinations. It's fully compatible with Docker and Kubernetes environments." ` - org.opencontainers.image.created=$IMAGE_CREATE_DATE ` - org.opencontainers.image.version=$FLUENTBIT_VERSION ` - org.opencontainers.image.authors="Eduardo Silva " ` - org.opencontainers.image.url="https://hub.docker.com/r/fluent/fluent-bit" ` - org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" ` - org.opencontainers.image.vendor="Fluent Organization" ` - org.opencontainers.image.licenses="Apache-2.0" ` - org.opencontainers.image.source="https://github.com/fluent/fluent-bit" ` - org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION - -COPY --from=builder /fluent-bit /fluent-bit - -RUN setx /M PATH "%PATH%;C:\fluent-bit\bin" - -ENTRYPOINT [ "fluent-bit.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:\dev\vcpkg\packages\openssl_x64-windows-static' -DFLB_LIBYAML_DIR='C:\dev\vcpkg\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 +# RUN New-Item -Path /fluent-bit/etc/ -ItemType "directory"; ` +# Copy-Item -Path /src/conf/fluent-bit-win32.conf /fluent-bit/etc/fluent-bit.conf; ` +# Copy-Item -Path /src/conf/parsers.conf /fluent-bit/etc/; ` +# Copy-Item -Path /src/conf/parsers_ambassador.conf /fluent-bit/etc/; ` +# Copy-Item -Path /src/conf/parsers_java.conf /fluent-bit/etc/; ` +# Copy-Item -Path /src/conf/parsers_extra.conf /fluent-bit/etc/; ` +# 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/Release/fluent-bit.dll /fluent-bit/bin/; +# # +# # Runtime Image - Windows Server Core +# # +# FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as runtime + +# ARG FLUENTBIT_VERSION +# ARG IMAGE_CREATE_DATE +# ARG IMAGE_SOURCE_REVISION + +# # Metadata as defined in OCI image spec annotations +# # https://github.com/opencontainers/image-spec/blob/master/annotations.md +# LABEL org.opencontainers.image.title="Fluent Bit" ` +# org.opencontainers.image.description="Fluent Bit is an open source and multi-platform Log Processor and Forwarder which allows you to collect data/logs from different sources, unify and send them to multiple destinations. It's fully compatible with Docker and Kubernetes environments." ` +# org.opencontainers.image.created=$IMAGE_CREATE_DATE ` +# org.opencontainers.image.version=$FLUENTBIT_VERSION ` +# org.opencontainers.image.authors="Eduardo Silva " ` +# org.opencontainers.image.url="https://hub.docker.com/r/fluent/fluent-bit" ` +# org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" ` +# org.opencontainers.image.vendor="Fluent Organization" ` +# org.opencontainers.image.licenses="Apache-2.0" ` +# org.opencontainers.image.source="https://github.com/fluent/fluent-bit" ` +# org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION + +# COPY --from=builder /fluent-bit /fluent-bit + +# RUN setx /M PATH "%PATH%;C:\fluent-bit\bin" + +# ENTRYPOINT [ "fluent-bit.exe" ] +FROM fluent/fluent-bit:${FLUENBIT_IMAGE_WINDOWS_SERVER_VERSION}-${FLUENTBIT_VERSION} COPY --from=nrBuilder /build/out_newrelic.dll /fluent-bit/bin/out_newrelic.dll -CMD ["fluent-bit.exe", "-i", "dummy", "-o", "stdout", "-e", "/fluent-bit/bin/out_newrelic.dll"] +CMD ["fluent-bit.exe", "-i", "dummy", "-o", "stdout", "-e", "/fluent-bit/bin/out_newrelic.dll"] \ No newline at end of file