Skip to content

Commit 21864e7

Browse files
authored
Merge pull request #284 from infosiftr/verify-no-distro-ruby
Add some verification that we have no "distro ruby" packages
2 parents 2a6352e + aacff43 commit 21864e7

File tree

20 files changed

+84
-0
lines changed

20 files changed

+84
-0
lines changed

2.4/alpine3.10/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ RUN set -eux; \
110110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
111111
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
112112
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
113+
# verify we have no "ruby" packages installed
114+
! apk --no-network list --installed \
115+
| grep -v '^[.]ruby-rundeps' \
116+
| grep -i ruby \
117+
; \
118+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
113119
# rough smoke test
114120
ruby --version; \
115121
gem --version; \

2.4/alpine3.9/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ RUN set -eux; \
110110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
111111
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
112112
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
113+
# verify we have no "ruby" packages installed
114+
! apk --no-network list --installed \
115+
| grep -v '^[.]ruby-rundeps' \
116+
| grep -i ruby \
117+
; \
118+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
113119
# rough smoke test
114120
ruby --version; \
115121
gem --version; \

2.4/jessie/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ RUN set -eux; \
7272
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
7373
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
7474
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
75+
# verify we have no "ruby" packages installed
76+
! dpkg -l | grep -i ruby; \
77+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7578
# rough smoke test
7679
ruby --version; \
7780
gem --version; \

2.4/jessie/slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ RUN set -eux; \
9797
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
9898
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
9999
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
100+
# verify we have no "ruby" packages installed
101+
! dpkg -l | grep -i ruby; \
102+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
100103
# rough smoke test
101104
ruby --version; \
102105
gem --version; \

2.4/stretch/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ RUN set -eux; \
7272
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
7373
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
7474
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
75+
# verify we have no "ruby" packages installed
76+
! dpkg -l | grep -i ruby; \
77+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7578
# rough smoke test
7679
ruby --version; \
7780
gem --version; \

2.4/stretch/slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ RUN set -eux; \
9797
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
9898
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
9999
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
100+
# verify we have no "ruby" packages installed
101+
! dpkg -l | grep -i ruby; \
102+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
100103
# rough smoke test
101104
ruby --version; \
102105
gem --version; \

2.5/alpine3.10/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ RUN set -eux; \
110110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
111111
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
112112
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
113+
# verify we have no "ruby" packages installed
114+
! apk --no-network list --installed \
115+
| grep -v '^[.]ruby-rundeps' \
116+
| grep -i ruby \
117+
; \
118+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
113119
# rough smoke test
114120
ruby --version; \
115121
gem --version; \

2.5/alpine3.9/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ RUN set -eux; \
110110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
111111
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
112112
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
113+
# verify we have no "ruby" packages installed
114+
! apk --no-network list --installed \
115+
| grep -v '^[.]ruby-rundeps' \
116+
| grep -i ruby \
117+
; \
118+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
113119
# rough smoke test
114120
ruby --version; \
115121
gem --version; \

2.5/stretch/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ RUN set -eux; \
7272
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
7373
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
7474
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
75+
# verify we have no "ruby" packages installed
76+
! dpkg -l | grep -i ruby; \
77+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7578
# rough smoke test
7679
ruby --version; \
7780
gem --version; \

2.5/stretch/slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ RUN set -eux; \
9797
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
9898
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
9999
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
100+
# verify we have no "ruby" packages installed
101+
! dpkg -l | grep -i ruby; \
102+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
100103
# rough smoke test
101104
ruby --version; \
102105
gem --version; \

2.6/alpine3.10/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ RUN set -eux; \
106106
\
107107
cd /; \
108108
rm -r /usr/src/ruby; \
109+
# verify we have no "ruby" packages installed
110+
! apk --no-network list --installed \
111+
| grep -v '^[.]ruby-rundeps' \
112+
| grep -i ruby \
113+
; \
114+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
109115
# rough smoke test
110116
ruby --version; \
111117
gem --version; \

2.6/alpine3.9/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ RUN set -eux; \
106106
\
107107
cd /; \
108108
rm -r /usr/src/ruby; \
109+
# verify we have no "ruby" packages installed
110+
! apk --no-network list --installed \
111+
| grep -v '^[.]ruby-rundeps' \
112+
| grep -i ruby \
113+
; \
114+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
109115
# rough smoke test
110116
ruby --version; \
111117
gem --version; \

2.6/stretch/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ RUN set -eux; \
6868
\
6969
cd /; \
7070
rm -r /usr/src/ruby; \
71+
# verify we have no "ruby" packages installed
72+
! dpkg -l | grep -i ruby; \
73+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7174
# rough smoke test
7275
ruby --version; \
7376
gem --version; \

2.6/stretch/slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ RUN set -eux; \
9393
\
9494
cd /; \
9595
rm -r /usr/src/ruby; \
96+
# verify we have no "ruby" packages installed
97+
! dpkg -l | grep -i ruby; \
98+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
9699
# rough smoke test
97100
ruby --version; \
98101
gem --version; \

2.7-rc/alpine3.10/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ RUN set -eux; \
106106
\
107107
cd /; \
108108
rm -r /usr/src/ruby; \
109+
# verify we have no "ruby" packages installed
110+
! apk --no-network list --installed \
111+
| grep -v '^[.]ruby-rundeps' \
112+
| grep -i ruby \
113+
; \
114+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
109115
# rough smoke test
110116
ruby --version; \
111117
gem --version; \

2.7-rc/buster/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ RUN set -eux; \
6868
\
6969
cd /; \
7070
rm -r /usr/src/ruby; \
71+
# verify we have no "ruby" packages installed
72+
! dpkg -l | grep -i ruby; \
73+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7174
# rough smoke test
7275
ruby --version; \
7376
gem --version; \

2.7-rc/buster/slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ RUN set -eux; \
9494
\
9595
cd /; \
9696
rm -r /usr/src/ruby; \
97+
# verify we have no "ruby" packages installed
98+
! dpkg -l | grep -i ruby; \
99+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
97100
# rough smoke test
98101
ruby --version; \
99102
gem --version; \

Dockerfile-alpine.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ RUN set -eux; \
110110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
111111
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
112112
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
113+
# verify we have no "ruby" packages installed
114+
! apk --no-network list --installed \
115+
| grep -v '^[.]ruby-rundeps' \
116+
| grep -i ruby \
117+
; \
118+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
113119
# rough smoke test
114120
ruby --version; \
115121
gem --version; \

Dockerfile-debian.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ RUN set -eux; \
7272
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
7373
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
7474
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
75+
# verify we have no "ruby" packages installed
76+
! dpkg -l | grep -i ruby; \
77+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
7578
# rough smoke test
7679
ruby --version; \
7780
gem --version; \

Dockerfile-slim.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ RUN set -eux; \
9898
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
9999
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
100100
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
101+
# verify we have no "ruby" packages installed
102+
! dpkg -l | grep -i ruby; \
103+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
101104
# rough smoke test
102105
ruby --version; \
103106
gem --version; \

0 commit comments

Comments
 (0)