diff --git a/Dockerfile.template.erb b/Dockerfile.template.erb index 695b699..91e2d8c 100644 --- a/Dockerfile.template.erb +++ b/Dockerfile.template.erb @@ -120,6 +120,11 @@ RUN apt-get update \ && gem install async -v 1.32.1 \ && gem install async-http -v 0.64.2 \ && gem install fluentd -v <%= fluentd_ver %> \ + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ + && echo GEM_DIR=$GEM_DIR \ + && rm -rf $GEM_DIR/cache/*.gem \ + && find $GEM_DIR -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rf \ + && find $GEM_DIR -name "*.so" | xargs -r strip \ <% if is_alpine %> && gem install bigdecimal -v 1.4.4 \ && apk del .build-deps \ @@ -146,7 +151,7 @@ RUN apt-get update \ '*-dev' \ && rm -rf /var/lib/apt/lists/* \ <% end %> - && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/3.*/gems/fluentd-*/test + && rm -rf /tmp/* /var/tmp/* <% if is_alpine %> RUN addgroup -S fluent && adduser -S -G fluent fluent \ diff --git a/v1.17/alpine/Dockerfile b/v1.17/alpine/Dockerfile index ab417b1..53b5b94 100644 --- a/v1.17/alpine/Dockerfile +++ b/v1.17/alpine/Dockerfile @@ -23,10 +23,15 @@ RUN apk update \ && gem install async -v 1.32.1 \ && gem install async-http -v 0.64.2 \ && gem install fluentd -v 1.17.1 \ + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ + && echo GEM_DIR=$GEM_DIR \ + && rm -rf $GEM_DIR/cache/*.gem \ + && find $GEM_DIR -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rf \ + && find $GEM_DIR -name "*.so" | xargs -r strip \ && 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 + && rm -rf /tmp/* /var/tmp/* RUN addgroup -S fluent && adduser -S -G fluent fluent \ # for log storage (maybe shared with host) diff --git a/v1.17/arm64/debian/Dockerfile b/v1.17/arm64/debian/Dockerfile index ed0b6be..c79f84e 100644 --- a/v1.17/arm64/debian/Dockerfile +++ b/v1.17/arm64/debian/Dockerfile @@ -35,6 +35,11 @@ RUN apt-get update \ && gem install async -v 1.32.1 \ && gem install async-http -v 0.64.2 \ && gem install fluentd -v 1.17.1 \ + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ + && echo GEM_DIR=$GEM_DIR \ + && rm -rf $GEM_DIR/cache/*.gem \ + && find $GEM_DIR -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rf \ + && find $GEM_DIR -name "*.so" | xargs -r strip \ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch" \ && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch.asc" \ @@ -55,7 +60,7 @@ RUN apt-get update \ $buildDeps \ '*-dev' \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/3.*/gems/fluentd-*/test + && rm -rf /tmp/* /var/tmp/* RUN groupadd -r fluent && useradd -r -g fluent fluent \ # for log storage (maybe shared with host) diff --git a/v1.17/armhf/debian/Dockerfile b/v1.17/armhf/debian/Dockerfile index 6375ee8..02d2550 100644 --- a/v1.17/armhf/debian/Dockerfile +++ b/v1.17/armhf/debian/Dockerfile @@ -35,6 +35,11 @@ RUN apt-get update \ && gem install async -v 1.32.1 \ && gem install async-http -v 0.64.2 \ && gem install fluentd -v 1.17.1 \ + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ + && echo GEM_DIR=$GEM_DIR \ + && rm -rf $GEM_DIR/cache/*.gem \ + && find $GEM_DIR -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rf \ + && find $GEM_DIR -name "*.so" | xargs -r strip \ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch" \ && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch.asc" \ @@ -55,7 +60,7 @@ RUN apt-get update \ $buildDeps \ '*-dev' \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/3.*/gems/fluentd-*/test + && rm -rf /tmp/* /var/tmp/* RUN groupadd -r fluent && useradd -r -g fluent fluent \ # for log storage (maybe shared with host) diff --git a/v1.17/debian/Dockerfile b/v1.17/debian/Dockerfile index 4a245d1..bd113d2 100644 --- a/v1.17/debian/Dockerfile +++ b/v1.17/debian/Dockerfile @@ -24,6 +24,11 @@ RUN apt-get update \ && gem install async -v 1.32.1 \ && gem install async-http -v 0.64.2 \ && gem install fluentd -v 1.17.1 \ + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ + && echo GEM_DIR=$GEM_DIR \ + && rm -rf $GEM_DIR/cache/*.gem \ + && find $GEM_DIR -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rf \ + && find $GEM_DIR -name "*.so" | xargs -r strip \ && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ && wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch" \ && wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$dpkgArch.asc" \ @@ -44,7 +49,7 @@ RUN apt-get update \ $buildDeps \ '*-dev' \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/3.*/gems/fluentd-*/test + && rm -rf /tmp/* /var/tmp/* RUN groupadd -r fluent && useradd -r -g fluent fluent \ # for log storage (maybe shared with host)