diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 71bff794d5..54f011fb16 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,5 +1,7 @@ FROM alpine:%%PLACEHOLDER%% +SHELL ["/usr/bin/env", "sh", "-eux", "-c"] + RUN apk add --no-cache \ gmp-dev @@ -20,9 +22,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%% # 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 # readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75 -RUN set -eux; \ - \ - apk add --no-cache --virtual .ruby-builddeps \ +RUN apk add --no-cache --virtual .ruby-builddeps \ autoconf \ bison \ bzip2 \ @@ -111,12 +111,13 @@ RUN set -eux; \ rm -r /usr/src/ruby; \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \ - gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \ + gem update --system "$RUBYGEMS_VERSION"; \ + rm -fr /root/.gem/; \ # verify we have no "ruby" packages installed - ! apk --no-network list --installed \ + if apk --no-network list --installed \ | grep -v '^[.]ruby-rundeps' \ | grep -i ruby \ - ; \ + ; then false; fi; \ [ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \ # rough smoke test ruby --version; \ @@ -129,6 +130,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ BUNDLE_APP_CONFIG="$GEM_HOME" ENV PATH $GEM_HOME/bin:$PATH # adjust permissions of a few directories for running "gem install" as an arbitrary user -RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME" +RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME" CMD [ "irb" ] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 6df3acde71..df106cb5ba 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -1,8 +1,9 @@ FROM buildpack-deps:%%PLACEHOLDER%% +SHELL ["/bin/bash", "-eux", "-c"] + # skip installing gem documentation -RUN set -eux; \ - mkdir -p /usr/local/etc; \ +RUN mkdir -p /usr/local/etc; \ { \ echo 'install: --no-document'; \ echo 'update: --no-document'; \ @@ -16,9 +17,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%% # 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 -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ +RUN savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends \ bison \ @@ -61,6 +60,7 @@ RUN set -eux; \ find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ + | grep -vF '/usr/local/lib' \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ @@ -72,9 +72,10 @@ RUN set -eux; \ rm -r /usr/src/ruby; \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \ - gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \ + gem update --system "$RUBYGEMS_VERSION"; \ + rm -fr /root/.gem/; \ # verify we have no "ruby" packages installed - ! dpkg -l | grep -i ruby; \ + if dpkg -l | grep -i 'ruby'; then false; fi; \ [ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \ # rough smoke test ruby --version; \ @@ -87,6 +88,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ BUNDLE_APP_CONFIG="$GEM_HOME" ENV PATH $GEM_HOME/bin:$PATH # adjust permissions of a few directories for running "gem install" as an arbitrary user -RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME" +RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME" CMD [ "irb" ] diff --git a/Dockerfile-slim.template b/Dockerfile-slim.template index 4ba64e7eaa..734cace3c9 100644 --- a/Dockerfile-slim.template +++ b/Dockerfile-slim.template @@ -1,7 +1,8 @@ FROM debian:%%PLACEHOLDER%% -RUN set -eux; \ - apt-get update; \ +SHELL ["/bin/bash", "-eux", "-c"] + +RUN apt-get update; \ apt-get install -y --no-install-recommends \ bzip2 \ ca-certificates \ @@ -15,8 +16,7 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* # skip installing gem documentation -RUN set -eux; \ - mkdir -p /usr/local/etc; \ +RUN mkdir -p /usr/local/etc; \ { \ echo 'install: --no-document'; \ echo 'update: --no-document'; \ @@ -30,9 +30,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%% # 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 -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ +RUN savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends \ autoconf \ @@ -87,6 +85,7 @@ RUN set -eux; \ find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ + | grep -vF '/usr/local/lib' \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ @@ -98,9 +97,10 @@ RUN set -eux; \ rm -r /usr/src/ruby; \ # make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246) ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \ - gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \ + gem update --system "$RUBYGEMS_VERSION"; \ + rm -r /root/.gem/; \ # verify we have no "ruby" packages installed - ! dpkg -l | grep -i ruby; \ + if dpkg -l | grep -i 'ruby'; then false; fi; \ [ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \ # rough smoke test ruby --version; \ @@ -113,6 +113,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \ BUNDLE_APP_CONFIG="$GEM_HOME" ENV PATH $GEM_HOME/bin:$PATH # adjust permissions of a few directories for running "gem install" as an arbitrary user -RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME" +RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME" CMD [ "irb" ]