Skip to content

Commit 7d48b5c

Browse files
author
Ryler Hockenbury
committed
Add windows server dockerfile
1 parent 48e0732 commit 7d48b5c

File tree

5 files changed

+48
-8
lines changed

5 files changed

+48
-8
lines changed

.circleci/build_and_push.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
33
aws ecr get-login --region $AWS_REGION --no-include-email | bash
4-
echo "Building docker image..."
5-
cp /tmp/pkg/fluent-plugin-splunk-hec-*.gem docker
6-
docker build --no-cache -t splunk/fluent-plugin-splunk-hec:ci ./docker
4+
echo "Building linux docker image..."
5+
cp /tmp/pkg/fluent-plugin-splunk-hec-*.gem docker/linux
6+
docker build --no-cache -t splunk/fluent-plugin-splunk-hec:ci ./docker/linux
77
docker tag splunk/fluent-plugin-splunk-hec:ci $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-logging:latest
88
echo "Push docker image to ecr..."
99
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/k8s-ci-logging:latest | awk 'END{print}'
10-
echo "Docker image pushed successfully."
10+
echo "Docker image pushed successfully."
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
22
set -e
3-
echo "Building docker image..."
4-
cp /tmp/pkg/fluent-plugin-splunk-hec-*.gem docker
3+
echo "Building linux docker image..."
4+
cp /tmp/pkg/fluent-plugin-splunk-hec-*.gem docker/linux
55
VERSION=`cat VERSION`
6-
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-splunk-hec:ci ./docker
6+
docker build --build-arg VERSION=$VERSION --no-cache -t splunk/fluent-plugin-splunk-hec:ci ./docker/linux
77
docker tag splunk/fluent-plugin-splunk-hec:ci splunk/${DOCKERHUB_REPO_NAME}:${VERSION}
88
echo "Push docker image to splunk dockerhub..."
99
docker login --username=$DOCKERHUB_ACCOUNT_ID --password=$DOCKERHUB_ACCOUNT_PASS
1010
docker push splunk/${DOCKERHUB_REPO_NAME}:${VERSION} | awk 'END{print}'
11-
echo "Docker image pushed successfully to docker-hub."
11+
echo "Docker image pushed successfully to docker-hub."
File renamed without changes.
File renamed without changes.

docker/windows/Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM mcr.microsoft.com/windows/servercore:ltsc2019
2+
3+
LABEL maintainer="Splunk Inc. <[email protected]>"
4+
5+
# skip runtime bundler installation
6+
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
7+
COPY *.gem /tmp/
8+
9+
RUN powershell -Command \
10+
Set-ExecutionPolicy Bypass -Scope Process -Force; \
11+
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
12+
13+
RUN choco install -y ruby --version 2.4.2.2 --params "'/InstallDir:C:\'" \
14+
&& choco install -y msys2 --params "'/NoPath /NoUpdate /InstallDir:C:\ruby24\msys64'" \
15+
&& refreshenv \
16+
&& ridk install 2 3
17+
18+
RUN echo gem: --no-document >> C:\ProgramData\gemrc \
19+
&& gem install -N fluentd -v "1.4.0" \
20+
&& gem install -N fluent-plugin-windows-eventlog -v "0.3.0" \
21+
&& gem install -N fluent-plugin-concat -v "2.2.2" \
22+
&& gem install -N fluent-plugin-prometheus -v "1.3.0" \
23+
&& gem install -N oj -v "3.5.1" \
24+
&& gem install -N /tmp/*.gem \
25+
&& gem sources --clear-all \
26+
&& mkdir C:\fluentd\etc
27+
28+
# plugin hardfails when using net-http-persistent 3.0.1 on windows
29+
# https://github.com/drbrain/net-http-persistent/issues/79#issuecomment-347541046
30+
# make an inline replacement to net-http-persistent to resolve
31+
RUN powershell -Command " \
32+
$file = 'C:\ruby24\lib\ruby\gems\2.4.0\gems\net-http-persistent-3.0.1\lib\net\http\persistent.rb'; \
33+
$content = (Get-Content -Path $file).Replace(\" DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4\", \" if Gem.win_platform? then`n DEFAULT_POOL_SIZE = 256`n else`n DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4`n end\"); \
34+
Set-Content -Path $file $content;"
35+
36+
# Remove gem cache
37+
RUN powershell -Command del C:\ruby24\lib\ruby\gems\2.4.0\cache\*.gem;
38+
39+
ENTRYPOINT ["cmd", "/k", "fluentd"]
40+
CMD ["-h"]

0 commit comments

Comments
 (0)