@@ -4,8 +4,9 @@ RUN apk add --no-cache \
4
4
gmp-dev
5
5
6
6
# skip installing gem documentation
7
- RUN mkdir -p /usr/local/etc \
8
- && { \
7
+ RUN set -eux; \
8
+ mkdir -p /usr/local/etc; \
9
+ { \
9
10
echo 'install: --no-document' ; \
10
11
echo 'update: --no-document' ; \
11
12
} >> /usr/local/etc/gemrc
@@ -18,9 +19,9 @@ ENV RUBYGEMS_VERSION 3.0.3
18
19
# some of ruby's build scripts are written in ruby
19
20
# we purge system ruby later to make sure our final image uses what we just built
20
21
# readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
21
- RUN set -ex \
22
+ RUN set -eux; \
22
23
\
23
- && apk add --no-cache --virtual .ruby-builddeps \
24
+ apk add --no-cache --virtual .ruby-builddeps \
24
25
autoconf \
25
26
bison \
26
27
bzip2 \
@@ -47,65 +48,72 @@ RUN set -ex \
47
48
xz \
48
49
yaml-dev \
49
50
zlib-dev \
51
+ ; \
50
52
\
51
- && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
52
- && echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \
53
+ wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" ; \
54
+ echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
53
55
\
54
- && mkdir -p /usr/src/ruby \
55
- && tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
56
- && rm ruby.tar.xz \
56
+ mkdir -p /usr/src/ruby; \
57
+ tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
58
+ rm ruby.tar.xz; \
57
59
\
58
- && cd /usr/src/ruby \
60
+ cd /usr/src/ruby; \
59
61
\
60
62
# https://github.com/docker-library/ruby/issues/196
61
63
# https://bugs.ruby-lang.org/issues/14387#note-13 (patch source)
62
64
# https://bugs.ruby-lang.org/issues/14387#note-16 ("Therefore ncopa's patch looks good for me in general." -- only breaks glibc which doesn't matter here)
63
- && wget -O 'thread-stack-fix.patch' 'https://bugs.ruby-lang.org/attachments/download/7081/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch' \
64
- && echo '3ab628a51d92fdf0d2b5835e93564857aea73e0c1de00313864a94a6255cb645 *thread-stack-fix.patch' | sha256sum -c - \
65
- && patch -p1 -i thread-stack-fix.patch \
66
- && rm thread-stack-fix.patch \
65
+ wget -O 'thread-stack-fix.patch' 'https://bugs.ruby-lang.org/attachments/download/7081/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch' ; \
66
+ echo '3ab628a51d92fdf0d2b5835e93564857aea73e0c1de00313864a94a6255cb645 *thread-stack-fix.patch' | sha256sum --check --strict; \
67
+ patch -p1 -i thread-stack-fix.patch; \
68
+ rm thread-stack-fix.patch; \
67
69
\
68
70
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
69
71
# warning: Insecure world writable dir
70
- && { \
72
+ { \
71
73
echo '#define ENABLE_PATH_CHECK 0' ; \
72
74
echo; \
73
75
cat file.c; \
74
- } > file.c.new \
75
- && mv file.c.new file.c \
76
+ } > file.c.new; \
77
+ mv file.c.new file.c; \
76
78
\
77
- && autoconf \
78
- && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
79
+ autoconf; \
80
+ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ; \
79
81
# the configure script does not detect isnan/isinf as macros
80
- && export ac_cv_func_isnan=yes ac_cv_func_isinf=yes \
81
- && ./configure \
82
+ export ac_cv_func_isnan=yes ac_cv_func_isinf=yes; \
83
+ ./configure \
82
84
--build="$gnuArch" \
83
85
--disable-install-doc \
84
86
--enable-shared \
85
- && make -j "$(nproc)" \
86
- && make install \
87
+ ; \
88
+ make -j "$(nproc)" ; \
89
+ make install; \
87
90
\
88
- && runDeps="$( \
91
+ runDeps="$( \
89
92
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
90
93
| tr ',' '\n ' \
91
94
| sort -u \
92
95
| awk 'system(" [ -e /usr/local/lib/" $1 " ]") == 0 { next } { print " so:" $1 }' \
93
- )" \
94
- && apk add --no-network --virtual .ruby-rundeps $runDeps \
96
+ )" ; \
97
+ apk add --no-network --virtual .ruby-rundeps \
98
+ $runDeps \
95
99
bzip2 \
96
100
ca-certificates \
97
101
libffi-dev \
98
102
procps \
99
103
yaml-dev \
100
104
zlib-dev \
101
- && apk del --no-network .ruby-builddeps \
102
- && cd / \
103
- && rm -r /usr/src/ruby \
105
+ ; \
106
+ apk del --no-network .ruby-builddeps; \
107
+ \
108
+ cd /; \
109
+ rm -r /usr/src/ruby; \
104
110
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
105
- && ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))' \
106
- && gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/ \
111
+ ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))' ; \
112
+ gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
107
113
# rough smoke test
108
- && ruby --version && gem --version && bundle --version
114
+ ruby --version; \
115
+ gem --version; \
116
+ bundle --version
109
117
110
118
# install things globally, for great justice
111
119
# and don't create ".bundle" in all our apps
0 commit comments