Skip to content

Commit

Permalink
Merge pull request #48 from wxpppp/main
Browse files Browse the repository at this point in the history
Add fluent/fluentd:1.16.5-alpine
  • Loading branch information
wxpppp authored May 13, 2024
2 parents 4f195f7 + 2ce08bf commit 2ee10d4
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 0 deletions.
53 changes: 53 additions & 0 deletions fluent/fluentd/1.16.5-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.template.erb

FROM lcr.loongnix.cn/library/alpine:3.19
LABEL maintainer "Weijie Wang <[email protected]>"
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.16.5"

# Do not split this into multiple RUN!
# Docker creates a layer for every RUN-Statement
# therefore an 'apk delete' has no effect
RUN apk update \
&& apk add --no-cache \
ca-certificates \
ruby ruby-irb ruby-etc ruby-webrick \
tini \
&& apk add --no-cache --virtual .build-deps \
build-base linux-headers \
ruby-dev gnupg \
# Set rubygems.loongnix.cn
&& gem sources -r https://rubygems.org/ && gem source -a https://rubygems.loongnix.cn \
&& echo 'gem: --no-document' >> /etc/gemrc \
&& gem install oj -v 3.16.1 \
&& gem install json -v 2.6.3 \
&& gem install rexml -v 3.2.6 \
&& gem install async -v 1.31.0 \
&& gem install async-http -v 0.60.2 \
&& gem install fluentd -v 1.16.5 \
&& gem install bigdecimal -v 1.4.4 \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/3.*/gems/fluentd-*/test

RUN addgroup -S fluent && adduser -S -G fluent fluent \
# for log storage (maybe shared with host)
&& mkdir -p /fluentd/log \
# configuration/plugins path (default: copied from .)
&& mkdir -p /fluentd/etc /fluentd/plugins \
&& chown -R fluent /fluentd && chgrp -R fluent /fluentd


COPY fluent.conf /fluentd/etc/
COPY entrypoint.sh /bin/


ENV FLUENTD_CONF="fluent.conf"

ENV LD_PRELOAD=""
EXPOSE 24224 5140

USER fluent
ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"]
CMD ["fluentd"]

28 changes: 28 additions & 0 deletions fluent/fluentd/1.16.5-alpine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is generated by the template.

REGISTRY ?=lcr.loongnix.cn
ORGANIZATION ?=fluent
REPOSITORY ?=fluentd
TAG ?=1.16.5-alpine
LATEST ?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

default: image

image:
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-t $(IMAGE) \
.

push:
docker push $(IMAGE)
#latest image
@if [ $(LATEST) = "true" ]; \
then \
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE); \
fi
28 changes: 28 additions & 0 deletions fluent/fluentd/1.16.5-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

#source vars if file exists
DEFAULT=/etc/default/fluentd

if [ -r $DEFAULT ]; then
set -o allexport
. $DEFAULT
set +o allexport
fi

# If the user has supplied only arguments append them to `fluentd` command
if [ "${1#-}" != "$1" ]; then
set -- fluentd "$@"
fi

# If user does not supply config file or plugins, use the default
if [ "$1" = "fluentd" ]; then
if ! echo $@ | grep -e ' \-c' -e ' \-\-config' ; then
set -- "$@" --config /fluentd/etc/${FLUENTD_CONF}
fi

if ! echo $@ | grep -e ' \-p' -e ' \-\-plugin' ; then
set -- "$@" --plugin /fluentd/plugins
fi
fi

exec "$@"
33 changes: 33 additions & 0 deletions fluent/fluentd/1.16.5-alpine/fluent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<source>
@type forward
@id input1
@label @mainstream
port 24224
</source>

<filter **>
@type stdout
</filter>

<label @mainstream>
<match docker.**>
@type file
@id output_docker1
path /fluentd/log/docker.*.log
symlink_path /fluentd/log/docker.log
append true
time_slice_format %Y%m%d
time_slice_wait 1m
time_format %Y%m%dT%H%M%S%z
</match>
<match **>
@type file
@id output1
path /fluentd/log/data.*.log
symlink_path /fluentd/log/data.log
append true
time_slice_format %Y%m%d
time_slice_wait 10m
time_format %Y%m%dT%H%M%S%z
</match>
</label>
16 changes: 16 additions & 0 deletions fluent/fluentd/1.16.5-alpine/hooks/post_push
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /post_push.erb

set -e

# Parse image name for repo name
tagStart=$(expr index "$IMAGE_NAME" :)
repoName=${IMAGE_NAME:0:tagStart-1}

# Tag and push image for each additional tag
for tag in {v1.16.5-1.0,v1.16-2,edge}; do
docker tag $IMAGE_NAME ${repoName}:${tag}
docker push ${repoName}:${tag}

done

0 comments on commit 2ee10d4

Please sign in to comment.