FROM fluent/fluentd:v1.19-debian-1

# User permissions are dropped in the entrypoint script
USER root

# Updates
RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install awscli curl
RUN apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN  fluent-gem install \
  fluent-plugin-datadog

ENV Environment='dev'

COPY fluent.conf /fluentd/etc/fluent.conf
COPY conf.d /fluentd/etc/conf.d/
COPY fluent_start_wrapper.sh /usr/local/bin/fluent_start_wrapper.sh
RUN  chmod +x /usr/local/bin/fluent_start_wrapper.sh

EXPOSE 8888/tcp
EXPOSE 5160/udp

CMD /usr/local/bin/fluent_start_wrapper.sh
