|
| 1 | +# escape=` |
| 2 | + |
| 3 | +ARG WINDOWS_VERSION=ltsc2019 |
| 4 | + |
| 5 | +# |
| 6 | +# Builder Image - Windows Server Core |
| 7 | +# |
| 8 | +FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as builder |
| 9 | + |
| 10 | +# The FLUENTBIT_VERSION ARG must be after the FROM instruction |
| 11 | +ARG FLUENTBIT_VERSION=1.6.10 |
| 12 | +ARG IMAGE_CREATE_DATE |
| 13 | +ARG IMAGE_SOURCE_REVISION |
| 14 | + |
| 15 | +# Metadata as defined in OCI image spec annotations |
| 16 | +# https://github.com/opencontainers/image-spec/blob/master/annotations.md |
| 17 | +LABEL org.opencontainers.image.title="Fluent Bit" ` |
| 18 | + 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." ` |
| 19 | + org.opencontainers.image.created=$IMAGE_CREATE_DATE ` |
| 20 | + org.opencontainers.image.version=$FLUENTBIT_VERSION ` |
| 21 | + org.opencontainers.image.authors="Eduardo Silva < [email protected]>" ` |
| 22 | + org.opencontainers.image.url="https://hub.docker.com/r/fluent/fluent-bit" ` |
| 23 | + org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" ` |
| 24 | + org.opencontainers.image.vendor="Fluent Organization" ` |
| 25 | + org.opencontainers.image.licenses="Apache-2.0" ` |
| 26 | + org.opencontainers.image.source="https://github.com/fluent/fluent-bit" ` |
| 27 | + org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION |
| 28 | + |
| 29 | +# |
| 30 | +# Basic setup |
| 31 | +# |
| 32 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 33 | + |
| 34 | +RUN Write-Host ('Creating folders'); ` |
| 35 | + New-Item -Type Directory -Path /local; ` |
| 36 | + New-Item -Type Directory -Path /fluent-bit; |
| 37 | + |
| 38 | +WORKDIR /local |
| 39 | + |
| 40 | +# |
| 41 | +# Install Fluent Bit |
| 42 | +# |
| 43 | +RUN Write-Host ('Installing Fluent Bit'); ` |
| 44 | + $majorminor = ([Version]::Parse("$env:FLUENTBIT_VERSION")).toString(2); ` |
| 45 | + Invoke-WebRequest -Uri "https://fluentbit.io/releases/$($majorminor)/td-agent-bit-$($env:FLUENTBIT_VERSION)-win64.zip" -OutFile td-agent-bit.zip; ` |
| 46 | + Expand-Archive -Path td-agent-bit.zip -Destination /local/fluent-bit; ` |
| 47 | + Move-Item -Path /local/fluent-bit/*/* -Destination /fluent-bit/; |
| 48 | + |
| 49 | +# |
| 50 | +# Technique from https://github.com/StefanScherer/dockerfiles-windows/blob/master/mongo/3.6/Dockerfile |
| 51 | +# |
| 52 | +ADD https://aka.ms/vs/15/release/vc_redist.x64.exe /local/vc_redist.x64.exe |
| 53 | + |
| 54 | +RUN Write-Host ('Installing Visual C++ Redistributable Package'); ` |
| 55 | + Start-Process /local/vc_redist.x64.exe -ArgumentList '/install', '/quiet', '/norestart' -NoNewWindow -Wait; ` |
| 56 | + Copy-Item -Path /Windows/System32/msvcp140.dll -Destination /fluent-bit/bin/; ` |
| 57 | + Copy-Item -Path /Windows/System32/vccorlib140.dll -Destination /fluent-bit/bin/; ` |
| 58 | + Copy-Item -Path /Windows/System32/vcruntime140.dll -Destination /fluent-bit/bin/; |
| 59 | + |
| 60 | +# |
| 61 | +# Runtime Image - Windows Server Nano |
| 62 | +# |
| 63 | +FROM mcr.microsoft.com/windows/servercore:$WINDOWS_VERSION as runtime |
| 64 | + |
| 65 | +COPY --from=builder /fluent-bit /fluent-bit |
| 66 | + |
| 67 | +RUN setx /M PATH "%PATH%;C:\fluent-bit\bin" |
| 68 | + |
| 69 | +ENTRYPOINT ["fluent-bit.exe", "-i", "dummy", "-o", "stdout"] |
0 commit comments