From 0d7685456d325887804368b64446673b8dab68b2 Mon Sep 17 00:00:00 2001 From: Kamil Grabowski Date: Mon, 5 Jun 2017 15:09:45 +0200 Subject: [PATCH] Remove unnecessary ruby-libs package Alpine version of ruby image installs unnecessary dependency `ruby-libs`. ``` $ docker container run --rm -ti ruby:2.3-alpine /bin/sh -c 'apk -vv info | grep ruby' ruby-libs-2.3.1-r0 - Libraries necessary to run Ruby .ruby-rundeps-0 - virtual meta package ``` ``` $ docker container run --rm -ti ruby:2.3-alpine ruby -v ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux-musl] ``` Currently the image contains two version of `libruby.so`: one created during building process and one installed by `apk`: ``` $ docker container run --rm -ti ruby:2.3-alpine /bin/sh -c 'find . -name libruby.so*' ./usr/lib/libruby.so.2.3 ./usr/lib/libruby.so.2.3.0 ./usr/local/lib/libruby.so ./usr/local/lib/libruby.so.2.3 ./usr/local/lib/libruby.so.2.3.0 ``` Ruby uses correct `libruby` version: ``` $ docker container run --rm -ti ruby:2.3-alpine /bin/sh -c 'ldd /usr/local/bin/ruby' /lib/ld-musl-x86_64.so.1 (0x5651cd9e5000) libruby.so.2.3 => /usr/local/lib/libruby.so.2.3 (0x7ff147d4c000) libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x5651cd9e5000) ``` I think we should not install `ruby-libs` from apk. This commits removes `ruby-libs` from `.ruby-rundeps`. --- 2.1/alpine/Dockerfile | 1 + 2.2/alpine/Dockerfile | 1 + 2.3/alpine/Dockerfile | 1 + 2.4/alpine/Dockerfile | 1 + Dockerfile-alpine.template | 1 + 5 files changed, 5 insertions(+) diff --git a/2.1/alpine/Dockerfile b/2.1/alpine/Dockerfile index 31dbb4743c..d6ccab6881 100644 --- a/2.1/alpine/Dockerfile +++ b/2.1/alpine/Dockerfile @@ -78,6 +78,7 @@ RUN set -ex \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ + | grep -v libruby \ | xargs -r apk info --installed \ | sort -u \ )" \ diff --git a/2.2/alpine/Dockerfile b/2.2/alpine/Dockerfile index 29992eeea7..19c55b2519 100644 --- a/2.2/alpine/Dockerfile +++ b/2.2/alpine/Dockerfile @@ -78,6 +78,7 @@ RUN set -ex \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ + | grep -v libruby \ | xargs -r apk info --installed \ | sort -u \ )" \ diff --git a/2.3/alpine/Dockerfile b/2.3/alpine/Dockerfile index 5cc1068878..aa376c888e 100644 --- a/2.3/alpine/Dockerfile +++ b/2.3/alpine/Dockerfile @@ -78,6 +78,7 @@ RUN set -ex \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ + | grep -v libruby \ | xargs -r apk info --installed \ | sort -u \ )" \ diff --git a/2.4/alpine/Dockerfile b/2.4/alpine/Dockerfile index a9128221a4..ae132cff94 100644 --- a/2.4/alpine/Dockerfile +++ b/2.4/alpine/Dockerfile @@ -78,6 +78,7 @@ RUN set -ex \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ + | grep -v libruby \ | xargs -r apk info --installed \ | sort -u \ )" \ diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index cf4ff8e2fa..0e9fdc6ae6 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -78,6 +78,7 @@ RUN set -ex \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | sort -u \ + | grep -v libruby \ | xargs -r apk info --installed \ | sort -u \ )" \