Dockerfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright 2017 The Kubernetes Authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # This Dockerfile will build an image that is configured
  15. # to run Fluentd with an Elasticsearch plug-in and the
  16. # provided configuration file.
  17. # The image acts as an executable for the binary /usr/sbin/td-agent.
  18. # Note that fluentd is run with root permssion to allow access to
  19. # log files with root only access under /var/log/containers/*
  20. FROM debian:stretch-slim
  21. ARG DEBIAN_FRONTEND=noninteractive
  22. COPY clean-apt /usr/bin
  23. COPY clean-install /usr/bin
  24. COPY Gemfile /Gemfile
  25. # 1. Install & configure dependencies.
  26. # 2. Install fluentd via ruby.
  27. # 3. Remove build dependencies.
  28. # 4. Cleanup leftover caches & files.
  29. RUN BUILD_DEPS="make gcc g++ libc6-dev ruby-dev libffi-dev" \
  30. && clean-install $BUILD_DEPS \
  31. ca-certificates \
  32. libjemalloc1 \
  33. ruby \
  34. && echo 'gem: --no-document' >> /etc/gemrc \
  35. && gem install --file Gemfile \
  36. && apt-get purge -y --auto-remove \
  37. -o APT::AutoRemove::RecommendsImportant=false \
  38. $BUILD_DEPS \
  39. && clean-apt \
  40. # Ensure fluent has enough file descriptors
  41. && ulimit -n 65536
  42. # Copy the Fluentd configuration file for logging Docker container logs.
  43. COPY fluent.conf /etc/fluent/fluent.conf
  44. COPY run.sh /run.sh
  45. # Expose prometheus metrics.
  46. EXPOSE 80
  47. ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1
  48. # Start Fluentd to pick up our config that watches Docker container logs.
  49. CMD ["/run.sh"]