From 538094886820059fd3f6d2ca82f39fdfe97cdf56 Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Thu, 4 Oct 2018 14:38:17 +0200 Subject: [PATCH 1/2] Ensure that package managers clean up Every package manager should clean up after themselves in order to keep docker layers neat and tiny: apt (Debian/Ubuntu package manager): - unneeded dependencies are cleared (autoremove) - caches are cleaned (clean) - package lists are deleted yum (CentOS package manager), zypper (OpenSuse package manager) - should clear caches after installing dependencies pip (Python package manager), apk (Alpine package manager) - should use no cache for installing dependencies --- Dockerfile.alpine-aws | 5 ++--- Dockerfile.danger | 2 ++ Dockerfile.gitlab-ui | 14 +++++++++----- Dockerfile.omnibus-gitlab-bionic | 2 ++ Dockerfile.omnibus-gitlab-centos6 | 9 +++++---- Dockerfile.omnibus-gitlab-centos7 | 9 +++++---- Dockerfile.omnibus-gitlab-jessie | 2 ++ Dockerfile.omnibus-gitlab-opensuse42.3 | 9 +++++---- Dockerfile.omnibus-gitlab-stretch | 2 ++ Dockerfile.omnibus-gitlab-trusty | 2 ++ Dockerfile.omnibus-gitlab-wheezy | 2 ++ Dockerfile.omnibus-gitlab-xenial | 2 ++ Dockerfile.release-tools | 2 +- scripts/install-ansible | 9 ++++++--- scripts/install-chrome | 4 ++++ scripts/install-essentials | 4 ++-- scripts/install-node | 4 ++++ scripts/install-postgresql | 3 +++ scripts/install-www-gitlab-com | 3 ++- 19 files changed, 62 insertions(+), 27 deletions(-) diff --git a/Dockerfile.alpine-aws b/Dockerfile.alpine-aws index 5eae47c..773467b 100644 --- a/Dockerfile.alpine-aws +++ b/Dockerfile.alpine-aws @@ -1,5 +1,4 @@ FROM alpine:latest -RUN apk --no-cache add py-pip - -RUN pip install awscli +RUN apk --no-cache add py-pip \ + && pip install --no-cache-dir awscli diff --git a/Dockerfile.danger b/Dockerfile.danger index 0282979..cd89826 100644 --- a/Dockerfile.danger +++ b/Dockerfile.danger @@ -6,6 +6,8 @@ ADD /scripts/ /scripts/ RUN apt-get update \ && apt-get install -y git \ && /scripts/install-node 8.x 1.2.1-1 \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* \ && gem install danger-gitlab --no-document \ && git version \ diff --git a/Dockerfile.gitlab-ui b/Dockerfile.gitlab-ui index 8a21b9a..7ec5158 100644 --- a/Dockerfile.gitlab-ui +++ b/Dockerfile.gitlab-ui @@ -1,8 +1,12 @@ FROM node:10-jessie # Workaround for https://github.com/GoogleChrome/puppeteer/issues/290 -RUN apt-get update && apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ - libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ - libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ - libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ - ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && rm -rf /var/lib/apt/lists/* +RUN apt-get update \ + && apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ + libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ + libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ + libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ + ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ + && rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile.omnibus-gitlab-bionic b/Dockerfile.omnibus-gitlab-bionic index 772d0c7..64d6888 100644 --- a/Dockerfile.omnibus-gitlab-bionic +++ b/Dockerfile.omnibus-gitlab-bionic @@ -2,6 +2,8 @@ FROM ubuntu:18.04 RUN apt-get update -q \ && apt-get install -y g++ gcc git make curl zlib1g-dev libssl1.0-dev locales \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen diff --git a/Dockerfile.omnibus-gitlab-centos6 b/Dockerfile.omnibus-gitlab-centos6 index 69371fa..bc290d0 100644 --- a/Dockerfile.omnibus-gitlab-centos6 +++ b/Dockerfile.omnibus-gitlab-centos6 @@ -1,9 +1,10 @@ FROM centos:centos6 -RUN yum update -y -q -RUN yum groupinstall -y Development Tools -RUN yum install -y \ - gcc gcc-c++ git make curl zlib-devel openssl-devel +RUN yum update -y -q \ + && yum groupinstall -y Development Tools \ + && yum install -y \ + gcc gcc-c++ git make curl zlib-devel openssl-devel \ + && yum clean all ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 diff --git a/Dockerfile.omnibus-gitlab-centos7 b/Dockerfile.omnibus-gitlab-centos7 index 24dcfcc..2106b61 100644 --- a/Dockerfile.omnibus-gitlab-centos7 +++ b/Dockerfile.omnibus-gitlab-centos7 @@ -1,9 +1,10 @@ FROM centos:centos7 -RUN yum update -y -q -RUN yum groupinstall -y Development Tools -RUN yum install -y \ - gcc gcc-c++ git make curl zlib-devel openssl-devel +RUN yum update -y -q \ + && yum groupinstall -y Development Tools \ + && yum install -y \ + gcc gcc-c++ git make curl zlib-devel openssl-devel \ + && yum clean all ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 diff --git a/Dockerfile.omnibus-gitlab-jessie b/Dockerfile.omnibus-gitlab-jessie index 7118368..509a3c6 100644 --- a/Dockerfile.omnibus-gitlab-jessie +++ b/Dockerfile.omnibus-gitlab-jessie @@ -2,6 +2,8 @@ FROM debian:jessie RUN apt-get update -q \ && apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev locales\ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen diff --git a/Dockerfile.omnibus-gitlab-opensuse42.3 b/Dockerfile.omnibus-gitlab-opensuse42.3 index 644a491..a691530 100644 --- a/Dockerfile.omnibus-gitlab-opensuse42.3 +++ b/Dockerfile.omnibus-gitlab-opensuse42.3 @@ -1,9 +1,10 @@ FROM opensuse:42.3 -RUN zypper -q -n --gpg-auto-import-keys update -RUN zypper -q -n in -t pattern devel_perl devel_basis -RUN zypper -q -n install \ - gcc gcc-c++ git make curl zlib-devel libopenssl-devel glibc-i18ndata glibc-locale +RUN zypper -q -n --gpg-auto-import-keys update \ + && zypper -q -n in -t pattern devel_perl devel_basis \ + && zypper -q -n install \ + gcc gcc-c++ git make curl zlib-devel libopenssl-devel glibc-i18ndata glibc-locale \ + && zypper clean -a ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 diff --git a/Dockerfile.omnibus-gitlab-stretch b/Dockerfile.omnibus-gitlab-stretch index 7509398..5929079 100644 --- a/Dockerfile.omnibus-gitlab-stretch +++ b/Dockerfile.omnibus-gitlab-stretch @@ -2,6 +2,8 @@ FROM debian:stretch RUN apt-get update -q \ && apt-get install -y g++ gcc git make curl zlib1g-dev libssl1.0-dev locales \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen diff --git a/Dockerfile.omnibus-gitlab-trusty b/Dockerfile.omnibus-gitlab-trusty index 7b1857b..2bd43ea 100644 --- a/Dockerfile.omnibus-gitlab-trusty +++ b/Dockerfile.omnibus-gitlab-trusty @@ -2,6 +2,8 @@ FROM ubuntu:14.04 RUN apt-get update -q \ && apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* ENV RUBY_VERSION 2.4.4 diff --git a/Dockerfile.omnibus-gitlab-wheezy b/Dockerfile.omnibus-gitlab-wheezy index 2ea33cf..092c8fb 100644 --- a/Dockerfile.omnibus-gitlab-wheezy +++ b/Dockerfile.omnibus-gitlab-wheezy @@ -2,6 +2,8 @@ FROM debian:wheezy RUN apt-get update -q \ && apt-get install -y g++ gcc git make libc6-dev curl zlib1g-dev libssl-dev locales \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen diff --git a/Dockerfile.omnibus-gitlab-xenial b/Dockerfile.omnibus-gitlab-xenial index a10c109..e7b90a8 100644 --- a/Dockerfile.omnibus-gitlab-xenial +++ b/Dockerfile.omnibus-gitlab-xenial @@ -2,6 +2,8 @@ FROM ubuntu:16.04 RUN apt-get update -q \ && apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev locales \ + && apt-get autoremove -yq \ + && apt-get clean -yqq \ && rm -rf /var/lib/apt/lists/* RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen diff --git a/Dockerfile.release-tools b/Dockerfile.release-tools index d136a45..13a828c 100644 --- a/Dockerfile.release-tools +++ b/Dockerfile.release-tools @@ -1,6 +1,6 @@ FROM ruby:2.4-alpine -RUN apk add --update build-base cmake git openssh-client +RUN apk add --update --no-cache build-base cmake git openssh-client # Set UTF-8 http://jaredmarkell.com/docker-and-locales/ ENV LANG en_US.UTF-8 diff --git a/scripts/install-ansible b/scripts/install-ansible index c63265b..dec9bc7 100755 --- a/scripts/install-ansible +++ b/scripts/install-ansible @@ -6,7 +6,10 @@ ANSIBLE_VERSION=$1 apt-get update apt-get install -y python-pip python-dev -apt-get clean -yqq -pip install --upgrade cffi -pip install "ansible==${ANSIBLE_VERSION}" +pip install --no-cache-dir --upgrade cffi +pip install --no-cache-dir "ansible==${ANSIBLE_VERSION}" + +apt-get autoremove -yq +apt-get clean -yqq +rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-chrome b/scripts/install-chrome index 3332ef0..6805e39 100755 --- a/scripts/install-chrome +++ b/scripts/install-chrome @@ -35,3 +35,7 @@ rm -rf /var/lib/apt/lists/* wget -q https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip unzip chromedriver_linux64.zip -d /usr/local/bin rm -f chromedriver_linux64.zip + +apt-get autoremove -yq +apt-get clean -yqq +rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-essentials b/scripts/install-essentials index b7bbf0a..2930877 100755 --- a/scripts/install-essentials +++ b/scripts/install-essentials @@ -16,8 +16,6 @@ apt-get install -y \ libkrb5-dev postgresql-client mysql-client unzip \ libre2-dev gettext \ -apt-get clean -yqq - # Set UTF-8 # http://stackoverflow.com/a/3182519/2137281 LOC=$'LC_ALL=en_US.UTF-8\nLANG=en_US.UTF-8' @@ -28,4 +26,6 @@ locale-gen dpkg-reconfigure locales -f noninteractive -p critical locale -a +apt-get autoremove -yq +apt-get clean -yqq rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-node b/scripts/install-node index d317050..e23316c 100755 --- a/scripts/install-node +++ b/scripts/install-node @@ -15,3 +15,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis apt-get update apt-get install -y nodejs yarn=$YARN_INSTALL_VERSION + +apt-get autoremove -yq +apt-get clean -yqq +rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-postgresql b/scripts/install-postgresql index 939715c..457d154 100755 --- a/scripts/install-postgresql +++ b/scripts/install-postgresql @@ -10,4 +10,7 @@ echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg ${POSTGRES_VERSIO apt-get update apt-get install -y postgresql-client + apt-get autoremove -yq +apt-get clean -yqq +rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-www-gitlab-com b/scripts/install-www-gitlab-com index 7662d55..9041586 100755 --- a/scripts/install-www-gitlab-com +++ b/scripts/install-www-gitlab-com @@ -11,7 +11,6 @@ apt-get install -yq --no-install-recommends \ git-core pandoc texlive-latex-recommended texlive-xetex \ texlive-fonts-recommended lmodern ed file curl gnupg2 -apt-get autoremove -yq # Set UTF-8 echo "en_US.UTF-8 UTF-8" > /etc/locale.gen @@ -19,4 +18,6 @@ locale-gen update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8 locale -a +apt-get autoremove -yq +apt-get clean -yqq rm -rf /var/lib/apt/lists/* From 8c009ec58668e2326b0a46587dc05cd6a854299f Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Thu, 4 Oct 2018 14:47:50 +0200 Subject: [PATCH 2/2] Delete ruby sources from omnibus images --- Dockerfile.omnibus-gitlab-bionic | 9 +++++---- Dockerfile.omnibus-gitlab-centos6 | 9 +++++---- Dockerfile.omnibus-gitlab-centos7 | 9 +++++---- Dockerfile.omnibus-gitlab-jessie | 9 +++++---- Dockerfile.omnibus-gitlab-opensuse42.3 | 9 +++++---- Dockerfile.omnibus-gitlab-stretch | 9 +++++---- Dockerfile.omnibus-gitlab-trusty | 9 +++++---- Dockerfile.omnibus-gitlab-wheezy | 9 +++++---- Dockerfile.omnibus-gitlab-xenial | 9 +++++---- 9 files changed, 45 insertions(+), 36 deletions(-) diff --git a/Dockerfile.omnibus-gitlab-bionic b/Dockerfile.omnibus-gitlab-bionic index 64d6888..9e796fc 100644 --- a/Dockerfile.omnibus-gitlab-bionic +++ b/Dockerfile.omnibus-gitlab-bionic @@ -15,9 +15,10 @@ ENV LC_ALL en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-centos6 b/Dockerfile.omnibus-gitlab-centos6 index bc290d0..ca70bed 100644 --- a/Dockerfile.omnibus-gitlab-centos6 +++ b/Dockerfile.omnibus-gitlab-centos6 @@ -13,9 +13,10 @@ RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-centos7 b/Dockerfile.omnibus-gitlab-centos7 index 2106b61..794155a 100644 --- a/Dockerfile.omnibus-gitlab-centos7 +++ b/Dockerfile.omnibus-gitlab-centos7 @@ -13,9 +13,10 @@ RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-jessie b/Dockerfile.omnibus-gitlab-jessie index 509a3c6..3f540f7 100644 --- a/Dockerfile.omnibus-gitlab-jessie +++ b/Dockerfile.omnibus-gitlab-jessie @@ -15,9 +15,10 @@ ENV LC_ALL en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-opensuse42.3 b/Dockerfile.omnibus-gitlab-opensuse42.3 index a691530..81ea03b 100644 --- a/Dockerfile.omnibus-gitlab-opensuse42.3 +++ b/Dockerfile.omnibus-gitlab-opensuse42.3 @@ -14,9 +14,10 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-stretch b/Dockerfile.omnibus-gitlab-stretch index 5929079..875ab12 100644 --- a/Dockerfile.omnibus-gitlab-stretch +++ b/Dockerfile.omnibus-gitlab-stretch @@ -16,9 +16,10 @@ ENV LC_ALL en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-trusty b/Dockerfile.omnibus-gitlab-trusty index 2bd43ea..82201d7 100644 --- a/Dockerfile.omnibus-gitlab-trusty +++ b/Dockerfile.omnibus-gitlab-trusty @@ -9,9 +9,10 @@ RUN apt-get update -q \ ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-wheezy b/Dockerfile.omnibus-gitlab-wheezy index 092c8fb..f5c102b 100644 --- a/Dockerfile.omnibus-gitlab-wheezy +++ b/Dockerfile.omnibus-gitlab-wheezy @@ -15,9 +15,10 @@ ENV LC_ALL en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document diff --git a/Dockerfile.omnibus-gitlab-xenial b/Dockerfile.omnibus-gitlab-xenial index e7b90a8..8594bb3 100644 --- a/Dockerfile.omnibus-gitlab-xenial +++ b/Dockerfile.omnibus-gitlab-xenial @@ -15,9 +15,10 @@ ENV LC_ALL en_US.UTF-8 ENV RUBY_VERSION 2.4.4 RUN curl -fsSL "https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RUBY_VERSION}.tar.gz" \ | tar -xzC /tmp \ - && cd /tmp/ruby-2.4.4 \ + && cd "/tmp/ruby-${RUBY_VERSION}" \ && ./configure --disable-install-rdoc --disable-install-doc --disable-install-capi\ && make \ - && make install - -RUN gem install bundler --no-document + && make install \ + && cd / \ + && rm -rf "/tmp/ruby-${RUBY_VERSION}" \ + && gem install bundler --no-document