Skip to content

Instantly share code, notes, and snippets.

@cemtopkaya
Created January 12, 2022 00:52
Show Gist options
  • Save cemtopkaya/bf7c7bbe5a96eacdfd953fd79a51fc40 to your computer and use it in GitHub Desktop.
Save cemtopkaya/bf7c7bbe5a96eacdfd953fd79a51fc40 to your computer and use it in GitHub Desktop.
Fluentd çalışan alpine linux temelli konteyner yansısı
# Kaynak: work.haufegroup.io/using-fluentd-with-multiple-log-targets/
FROM alpine:3.4
MAINTAINER Thomas Schuering <thomas.schuering@haufe-lexware.com>
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.1"
# Do not split this into multiple RUN!
# Docker creates a layer for every RUN-Statement
# therefore an 'apk delete build*' has no effect
RUN apk --no-cache --update add \
build-base \
ca-certificates \
ruby \
ruby-irb \
ruby-dev && \
echo 'gem: --no-document' >> /etc/gemrc && \
gem install oj && \
gem install fluentd -v 0.12.28 && \
apk del build-base ruby-dev && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /usr/lib/ruby/gems/*/cache/*.gem
RUN adduser -D -g '' -u 1000 -h /home/fluent fluent
RUN chown -R fluent:fluent /home/fluent
# for log storage (maybe shared with host)
RUN mkdir -p /fluentd/log
# configuration/plugins path (default: copied from .)
RUN mkdir -p /fluentd/etc /fluentd/plugins
RUN chown -R fluent:fluent /fluentd
USER fluent
WORKDIR /home/fluent
# Tell ruby to install packages as user
RUN echo "gem: --user-install --no-document" >> ~/.gemrc
ENV PATH /home/fluent/.gem/ruby/2.3.0/bin:$PATH
ENV GEM_PATH /home/fluent/.gem/ruby/2.3.0:$GEM_PATH
COPY fluent.conf /fluentd/etc/
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
EXPOSE 24224 5140
CMD exec fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment