install.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # Copyright 2017 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # A script encapsulating a common Dockerimage pattern for installing packages
  16. # and then cleaning up the unnecessary install artifacts.
  17. # e.g. clean-install iptables ebtables conntrack
  18. set -o errexit
  19. # 1. Install & configure dependencies.
  20. # 2. Install fluentd via ruby.
  21. # 3. Remove build dependencies.
  22. # 4. Cleanup leftover caches & files.
  23. BUILD_DEPS="make gcc g++ libc6-dev ruby-dev libffi-dev"
  24. # apt install
  25. apt-get update
  26. echo "${BUILD_DEPS} ca-certificates libjemalloc2 ruby" | xargs apt-get install -y --no-install-recommends
  27. # ruby install
  28. echo 'gem: --no-document' >> /etc/gemrc
  29. gem install --file Gemfile
  30. # cleanup
  31. echo "${BUILD_DEPS}" | xargs apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
  32. apt-get clean -y
  33. rm -rf \
  34. /var/cache/debconf/* \
  35. /var/lib/apt/lists/* \
  36. /var/log/* \
  37. /var/tmp/*
  38. # Ensure fluent has enough file descriptors
  39. ulimit -n 65536