From f35eefc3676315e3227702c312c63d0274c1b4a5 Mon Sep 17 00:00:00 2001 From: lsb Date: Tue, 26 Feb 2019 21:22:05 -0800 Subject: [PATCH 1/2] Add libgmp for faster Integer calculations. --- 2.3/jessie/Dockerfile | 2 ++ 2.3/stretch/Dockerfile | 2 ++ 2.4/jessie/Dockerfile | 2 ++ 2.4/stretch/Dockerfile | 2 ++ 2.5/stretch/Dockerfile | 2 ++ 2.6/stretch/Dockerfile | 2 ++ Dockerfile-debian.template | 2 ++ 7 files changed, 14 insertions(+) diff --git a/2.3/jessie/Dockerfile b/2.3/jessie/Dockerfile index 50b813f00..7b593616d 100644 --- a/2.3/jessie/Dockerfile +++ b/2.3/jessie/Dockerfile @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.3.8 ENV RUBY_DOWNLOAD_SHA256 910f635d84fd0d81ac9bdee0731279e6026cb4cd1315bbbb5dfb22e09c5c1dfe ENV RUBYGEMS_VERSION 3.0.1 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.3/stretch/Dockerfile b/2.3/stretch/Dockerfile index 628f4f5b3..7ab638981 100644 --- a/2.3/stretch/Dockerfile +++ b/2.3/stretch/Dockerfile @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.3.8 ENV RUBY_DOWNLOAD_SHA256 910f635d84fd0d81ac9bdee0731279e6026cb4cd1315bbbb5dfb22e09c5c1dfe ENV RUBYGEMS_VERSION 3.0.1 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.4/jessie/Dockerfile b/2.4/jessie/Dockerfile index a47cc2f85..fb25106e3 100644 --- a/2.4/jessie/Dockerfile +++ b/2.4/jessie/Dockerfile @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.4.5 ENV RUBY_DOWNLOAD_SHA256 2f0cdcce9989f63ef7c2939bdb17b1ef244c4f384d85b8531d60e73d8cc31eeb ENV RUBYGEMS_VERSION 3.0.1 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.4/stretch/Dockerfile b/2.4/stretch/Dockerfile index 4ba0cbb2b..cd45eb379 100644 --- a/2.4/stretch/Dockerfile +++ b/2.4/stretch/Dockerfile @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.4.5 ENV RUBY_DOWNLOAD_SHA256 2f0cdcce9989f63ef7c2939bdb17b1ef244c4f384d85b8531d60e73d8cc31eeb ENV RUBYGEMS_VERSION 3.0.1 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.5/stretch/Dockerfile b/2.5/stretch/Dockerfile index 8d9ab2692..88b1913f2 100644 --- a/2.5/stretch/Dockerfile +++ b/2.5/stretch/Dockerfile @@ -12,6 +12,8 @@ ENV RUBY_VERSION 2.5.3 ENV RUBY_DOWNLOAD_SHA256 1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f ENV RUBYGEMS_VERSION 3.0.1 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.6/stretch/Dockerfile b/2.6/stretch/Dockerfile index bed003c72..efc6829a7 100644 --- a/2.6/stretch/Dockerfile +++ b/2.6/stretch/Dockerfile @@ -11,6 +11,8 @@ ENV RUBY_MAJOR 2.6 ENV RUBY_VERSION 2.6.1 ENV RUBY_DOWNLOAD_SHA256 47b629808e9fd44ce1f760cdf3ed14875fc9b19d4f334e82e2cf25cb2898f2f2 +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 8cae1f194..ba6ab5ee1 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -12,6 +12,8 @@ ENV RUBY_VERSION %%FULL_VERSION%% ENV RUBY_DOWNLOAD_SHA256 %%SHA256%% ENV RUBYGEMS_VERSION %%RUBYGEMS%% +RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* + # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ From eae22dc2dfe30b48f1633912396110539e1b8d49 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 28 Feb 2019 16:24:23 -0800 Subject: [PATCH 2/2] Update "slim" and "alpine" variants to include libgmp --- 2.3/alpine3.7/Dockerfile | 1 + 2.3/alpine3.8/Dockerfile | 1 + 2.3/jessie/Dockerfile | 2 -- 2.3/jessie/slim/Dockerfile | 22 ++++++++++++++-------- 2.3/stretch/Dockerfile | 2 -- 2.3/stretch/slim/Dockerfile | 22 ++++++++++++++-------- 2.4/alpine3.8/Dockerfile | 1 + 2.4/alpine3.9/Dockerfile | 1 + 2.4/jessie/Dockerfile | 2 -- 2.4/jessie/slim/Dockerfile | 22 ++++++++++++++-------- 2.4/stretch/Dockerfile | 2 -- 2.4/stretch/slim/Dockerfile | 22 ++++++++++++++-------- 2.5/alpine3.8/Dockerfile | 1 + 2.5/alpine3.9/Dockerfile | 1 + 2.5/stretch/Dockerfile | 2 -- 2.5/stretch/slim/Dockerfile | 22 ++++++++++++++-------- 2.6/alpine3.8/Dockerfile | 1 + 2.6/alpine3.9/Dockerfile | 1 + 2.6/stretch/Dockerfile | 2 -- 2.6/stretch/slim/Dockerfile | 22 ++++++++++++++-------- Dockerfile-alpine.template | 1 + Dockerfile-debian.template | 2 -- Dockerfile-slim.template | 22 ++++++++++++++-------- 23 files changed, 107 insertions(+), 70 deletions(-) diff --git a/2.3/alpine3.7/Dockerfile b/2.3/alpine3.7/Dockerfile index f4ea5e884..118f76046 100644 --- a/2.3/alpine3.7/Dockerfile +++ b/2.3/alpine3.7/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.3/alpine3.8/Dockerfile b/2.3/alpine3.8/Dockerfile index ebf1b7ca0..59e810506 100644 --- a/2.3/alpine3.8/Dockerfile +++ b/2.3/alpine3.8/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.3/jessie/Dockerfile b/2.3/jessie/Dockerfile index 7b593616d..50b813f00 100644 --- a/2.3/jessie/Dockerfile +++ b/2.3/jessie/Dockerfile @@ -12,8 +12,6 @@ ENV RUBY_VERSION 2.3.8 ENV RUBY_DOWNLOAD_SHA256 910f635d84fd0d81ac9bdee0731279e6026cb4cd1315bbbb5dfb22e09c5c1dfe ENV RUBYGEMS_VERSION 3.0.1 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.3/jessie/slim/Dockerfile b/2.3/jessie/slim/Dockerfile index 26278a605..6605ade07 100644 --- a/2.3/jessie/slim/Dockerfile +++ b/2.3/jessie/slim/Dockerfile @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION 3.0.1 # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) diff --git a/2.3/stretch/Dockerfile b/2.3/stretch/Dockerfile index 7ab638981..628f4f5b3 100644 --- a/2.3/stretch/Dockerfile +++ b/2.3/stretch/Dockerfile @@ -12,8 +12,6 @@ ENV RUBY_VERSION 2.3.8 ENV RUBY_DOWNLOAD_SHA256 910f635d84fd0d81ac9bdee0731279e6026cb4cd1315bbbb5dfb22e09c5c1dfe ENV RUBYGEMS_VERSION 3.0.1 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.3/stretch/slim/Dockerfile b/2.3/stretch/slim/Dockerfile index c72481c98..365f2faf7 100644 --- a/2.3/stretch/slim/Dockerfile +++ b/2.3/stretch/slim/Dockerfile @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION 3.0.1 # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) diff --git a/2.4/alpine3.8/Dockerfile b/2.4/alpine3.8/Dockerfile index fdba4725d..92779e404 100644 --- a/2.4/alpine3.8/Dockerfile +++ b/2.4/alpine3.8/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.4/alpine3.9/Dockerfile b/2.4/alpine3.9/Dockerfile index 92c39fc29..6ce8f4b06 100644 --- a/2.4/alpine3.9/Dockerfile +++ b/2.4/alpine3.9/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.4/jessie/Dockerfile b/2.4/jessie/Dockerfile index fb25106e3..a47cc2f85 100644 --- a/2.4/jessie/Dockerfile +++ b/2.4/jessie/Dockerfile @@ -12,8 +12,6 @@ ENV RUBY_VERSION 2.4.5 ENV RUBY_DOWNLOAD_SHA256 2f0cdcce9989f63ef7c2939bdb17b1ef244c4f384d85b8531d60e73d8cc31eeb ENV RUBYGEMS_VERSION 3.0.1 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.4/jessie/slim/Dockerfile b/2.4/jessie/slim/Dockerfile index 6feb049e2..49ee44bd2 100644 --- a/2.4/jessie/slim/Dockerfile +++ b/2.4/jessie/slim/Dockerfile @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION 3.0.1 # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) diff --git a/2.4/stretch/Dockerfile b/2.4/stretch/Dockerfile index cd45eb379..4ba0cbb2b 100644 --- a/2.4/stretch/Dockerfile +++ b/2.4/stretch/Dockerfile @@ -12,8 +12,6 @@ ENV RUBY_VERSION 2.4.5 ENV RUBY_DOWNLOAD_SHA256 2f0cdcce9989f63ef7c2939bdb17b1ef244c4f384d85b8531d60e73d8cc31eeb ENV RUBYGEMS_VERSION 3.0.1 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.4/stretch/slim/Dockerfile b/2.4/stretch/slim/Dockerfile index 0e8c1a2ee..34c9e302c 100644 --- a/2.4/stretch/slim/Dockerfile +++ b/2.4/stretch/slim/Dockerfile @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION 3.0.1 # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) diff --git a/2.5/alpine3.8/Dockerfile b/2.5/alpine3.8/Dockerfile index 152c83197..50dce149d 100644 --- a/2.5/alpine3.8/Dockerfile +++ b/2.5/alpine3.8/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.5/alpine3.9/Dockerfile b/2.5/alpine3.9/Dockerfile index 283f77b99..ccf57d9a9 100644 --- a/2.5/alpine3.9/Dockerfile +++ b/2.5/alpine3.9/Dockerfile @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.5/stretch/Dockerfile b/2.5/stretch/Dockerfile index 88b1913f2..8d9ab2692 100644 --- a/2.5/stretch/Dockerfile +++ b/2.5/stretch/Dockerfile @@ -12,8 +12,6 @@ ENV RUBY_VERSION 2.5.3 ENV RUBY_DOWNLOAD_SHA256 1cc9d0359a8ea35fc6111ec830d12e60168f3b9b305a3c2578357d360fcf306f ENV RUBYGEMS_VERSION 3.0.1 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.5/stretch/slim/Dockerfile b/2.5/stretch/slim/Dockerfile index ce8ec6316..255b02db5 100644 --- a/2.5/stretch/slim/Dockerfile +++ b/2.5/stretch/slim/Dockerfile @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION 3.0.1 # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) diff --git a/2.6/alpine3.8/Dockerfile b/2.6/alpine3.8/Dockerfile index c81f291ff..4bb66c7ca 100644 --- a/2.6/alpine3.8/Dockerfile +++ b/2.6/alpine3.8/Dockerfile @@ -27,6 +27,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.6/alpine3.9/Dockerfile b/2.6/alpine3.9/Dockerfile index ab7dfbae8..72826da6b 100644 --- a/2.6/alpine3.9/Dockerfile +++ b/2.6/alpine3.9/Dockerfile @@ -27,6 +27,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/2.6/stretch/Dockerfile b/2.6/stretch/Dockerfile index efc6829a7..bed003c72 100644 --- a/2.6/stretch/Dockerfile +++ b/2.6/stretch/Dockerfile @@ -11,8 +11,6 @@ ENV RUBY_MAJOR 2.6 ENV RUBY_VERSION 2.6.1 ENV RUBY_DOWNLOAD_SHA256 47b629808e9fd44ce1f760cdf3ed14875fc9b19d4f334e82e2cf25cb2898f2f2 -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/2.6/stretch/slim/Dockerfile b/2.6/stretch/slim/Dockerfile index 03d34b18a..438bc8f4d 100644 --- a/2.6/stretch/slim/Dockerfile +++ b/2.6/stretch/slim/Dockerfile @@ -27,7 +27,8 @@ ENV RUBY_DOWNLOAD_SHA256 47b629808e9fd44ce1f760cdf3ed14875fc9b19d4f334e82e2cf25c # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -35,6 +36,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -43,9 +45,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -75,10 +74,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # rough smoke test diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 5b28ebf81..7a07b247f 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -28,6 +28,7 @@ RUN set -ex \ gcc \ gdbm-dev \ glib-dev \ + gmp-dev \ libc-dev \ libffi-dev \ libxml2-dev \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index ba6ab5ee1..8cae1f194 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -12,8 +12,6 @@ ENV RUBY_VERSION %%FULL_VERSION%% ENV RUBY_DOWNLOAD_SHA256 %%SHA256%% ENV RUBYGEMS_VERSION %%RUBYGEMS%% -RUN apt-get update && apt-get install -y libgmp3-dev && rm -rf /var/lib/apt/lists/* - # some of ruby's build scripts are written in ruby # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ diff --git a/Dockerfile-slim.template b/Dockerfile-slim.template index d0d5e6629..2fde2d1b3 100644 --- a/Dockerfile-slim.template +++ b/Dockerfile-slim.template @@ -28,7 +28,8 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%% # we purge system ruby later to make sure our final image uses what we just built RUN set -ex \ \ - && buildDeps=' \ + && savedAptMark="$(apt-mark showmanual)" \ + && apt-get update && apt-get install -y --no-install-recommends \ autoconf \ bison \ dpkg-dev \ @@ -36,6 +37,7 @@ RUN set -ex \ libbz2-dev \ libgdbm-dev \ libglib2.0-dev \ + libgmp-dev \ libncurses-dev \ libreadline-dev \ libxml2-dev \ @@ -44,9 +46,6 @@ RUN set -ex \ ruby \ wget \ xz-utils \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $buildDeps \ && rm -rf /var/lib/apt/lists/* \ \ && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ @@ -76,10 +75,17 @@ RUN set -ex \ && make -j "$(nproc)" \ && make install \ \ - && dpkg-query --show --showformat '${package}\n' \ - | grep -P '^libreadline\d+$' \ - | xargs apt-mark manual \ - && apt-get purge -y --auto-remove $buildDeps \ + && apt-mark auto '.*' > /dev/null \ + && apt-mark manual $savedAptMark \ + && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + \ && cd / \ && rm -r /usr/src/ruby \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)