Skip to content

Commit 57a8df4

Browse files
committed
Add ruby 3.0.0-preview1
1 parent 8813cdd commit 57a8df4

File tree

4 files changed

+333
-0
lines changed

4 files changed

+333
-0
lines changed

3.0-rc/alpine3.12/Dockerfile

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
FROM alpine:3.12
2+
3+
RUN apk add --no-cache \
4+
gmp-dev
5+
6+
# skip installing gem documentation
7+
RUN set -eux; \
8+
mkdir -p /usr/local/etc; \
9+
{ \
10+
echo 'install: --no-document'; \
11+
echo 'update: --no-document'; \
12+
} >> /usr/local/etc/gemrc
13+
14+
ENV LANG C.UTF-8
15+
ENV RUBY_MAJOR 3.0-rc
16+
ENV RUBY_VERSION 3.0.0-preview1
17+
ENV RUBY_DOWNLOAD_SHA256 aa7cce0c99f4ea2145fef9b78d74a44857754396790cd23bad75d759811e7a2a
18+
19+
# some of ruby's build scripts are written in ruby
20+
# we purge system ruby later to make sure our final image uses what we just built
21+
# readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
22+
RUN set -eux; \
23+
\
24+
apk add --no-cache --virtual .ruby-builddeps \
25+
autoconf \
26+
bison \
27+
bzip2 \
28+
bzip2-dev \
29+
ca-certificates \
30+
coreutils \
31+
dpkg-dev dpkg \
32+
gcc \
33+
gdbm-dev \
34+
glib-dev \
35+
libc-dev \
36+
libffi-dev \
37+
libxml2-dev \
38+
libxslt-dev \
39+
linux-headers \
40+
make \
41+
ncurses-dev \
42+
openssl \
43+
openssl-dev \
44+
patch \
45+
procps \
46+
readline-dev \
47+
ruby \
48+
tar \
49+
xz \
50+
yaml-dev \
51+
zlib-dev \
52+
; \
53+
\
54+
wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"; \
55+
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
56+
\
57+
mkdir -p /usr/src/ruby; \
58+
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
59+
rm ruby.tar.xz; \
60+
\
61+
cd /usr/src/ruby; \
62+
\
63+
# https://github.com/docker-library/ruby/issues/196
64+
# https://bugs.ruby-lang.org/issues/14387#note-13 (patch source)
65+
# 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)
66+
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'; \
67+
echo '3ab628a51d92fdf0d2b5835e93564857aea73e0c1de00313864a94a6255cb645 *thread-stack-fix.patch' | sha256sum --check --strict; \
68+
patch -p1 -i thread-stack-fix.patch; \
69+
rm thread-stack-fix.patch; \
70+
\
71+
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
72+
# warning: Insecure world writable dir
73+
{ \
74+
echo '#define ENABLE_PATH_CHECK 0'; \
75+
echo; \
76+
cat file.c; \
77+
} > file.c.new; \
78+
mv file.c.new file.c; \
79+
\
80+
autoconf; \
81+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
82+
# the configure script does not detect isnan/isinf as macros
83+
export ac_cv_func_isnan=yes ac_cv_func_isinf=yes; \
84+
./configure \
85+
--build="$gnuArch" \
86+
--disable-install-doc \
87+
--enable-shared \
88+
; \
89+
make -j "$(nproc)"; \
90+
make install; \
91+
\
92+
runDeps="$( \
93+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
94+
| tr ',' '\n' \
95+
| sort -u \
96+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
97+
)"; \
98+
apk add --no-network --virtual .ruby-rundeps \
99+
$runDeps \
100+
bzip2 \
101+
ca-certificates \
102+
libffi-dev \
103+
procps \
104+
yaml-dev \
105+
zlib-dev \
106+
; \
107+
apk del --no-network .ruby-builddeps; \
108+
\
109+
cd /; \
110+
rm -r /usr/src/ruby; \
111+
# verify we have no "ruby" packages installed
112+
! apk --no-network list --installed \
113+
| grep -v '^[.]ruby-rundeps' \
114+
| grep -i ruby \
115+
; \
116+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
117+
# rough smoke test
118+
ruby --version; \
119+
gem --version; \
120+
bundle --version
121+
122+
# don't create ".bundle" in all our apps
123+
ENV GEM_HOME /usr/local/bundle
124+
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
125+
BUNDLE_APP_CONFIG="$GEM_HOME"
126+
ENV PATH $GEM_HOME/bin:$PATH
127+
# adjust permissions of a few directories for running "gem install" as an arbitrary user
128+
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
129+
130+
CMD [ "irb" ]

3.0-rc/buster/Dockerfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
FROM buildpack-deps:buster
2+
3+
# skip installing gem documentation
4+
RUN set -eux; \
5+
mkdir -p /usr/local/etc; \
6+
{ \
7+
echo 'install: --no-document'; \
8+
echo 'update: --no-document'; \
9+
} >> /usr/local/etc/gemrc
10+
11+
ENV LANG C.UTF-8
12+
ENV RUBY_MAJOR 3.0-rc
13+
ENV RUBY_VERSION 3.0.0-preview1
14+
ENV RUBY_DOWNLOAD_SHA256 aa7cce0c99f4ea2145fef9b78d74a44857754396790cd23bad75d759811e7a2a
15+
16+
# some of ruby's build scripts are written in ruby
17+
# we purge system ruby later to make sure our final image uses what we just built
18+
RUN set -eux; \
19+
\
20+
savedAptMark="$(apt-mark showmanual)"; \
21+
apt-get update; \
22+
apt-get install -y --no-install-recommends \
23+
bison \
24+
dpkg-dev \
25+
libgdbm-dev \
26+
ruby \
27+
; \
28+
rm -rf /var/lib/apt/lists/*; \
29+
\
30+
wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"; \
31+
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
32+
\
33+
mkdir -p /usr/src/ruby; \
34+
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
35+
rm ruby.tar.xz; \
36+
\
37+
cd /usr/src/ruby; \
38+
\
39+
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
40+
# warning: Insecure world writable dir
41+
{ \
42+
echo '#define ENABLE_PATH_CHECK 0'; \
43+
echo; \
44+
cat file.c; \
45+
} > file.c.new; \
46+
mv file.c.new file.c; \
47+
\
48+
autoconf; \
49+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
50+
./configure \
51+
--build="$gnuArch" \
52+
--disable-install-doc \
53+
--enable-shared \
54+
; \
55+
make -j "$(nproc)"; \
56+
make install; \
57+
\
58+
apt-mark auto '.*' > /dev/null; \
59+
apt-mark manual $savedAptMark > /dev/null; \
60+
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
61+
| awk '/=>/ { print $(NF-1) }' \
62+
| sort -u \
63+
| xargs -r dpkg-query --search \
64+
| cut -d: -f1 \
65+
| sort -u \
66+
| xargs -r apt-mark manual \
67+
; \
68+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
69+
\
70+
cd /; \
71+
rm -r /usr/src/ruby; \
72+
# verify we have no "ruby" packages installed
73+
! dpkg -l | grep -i ruby; \
74+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
75+
# rough smoke test
76+
ruby --version; \
77+
gem --version; \
78+
bundle --version
79+
80+
# don't create ".bundle" in all our apps
81+
ENV GEM_HOME /usr/local/bundle
82+
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
83+
BUNDLE_APP_CONFIG="$GEM_HOME"
84+
ENV PATH $GEM_HOME/bin:$PATH
85+
# adjust permissions of a few directories for running "gem install" as an arbitrary user
86+
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
87+
88+
CMD [ "irb" ]

3.0-rc/buster/slim/Dockerfile

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
FROM debian:buster-slim
2+
3+
RUN set -eux; \
4+
apt-get update; \
5+
apt-get install -y --no-install-recommends \
6+
bzip2 \
7+
ca-certificates \
8+
libffi-dev \
9+
libgmp-dev \
10+
libssl-dev \
11+
libyaml-dev \
12+
procps \
13+
zlib1g-dev \
14+
; \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
# skip installing gem documentation
18+
RUN set -eux; \
19+
mkdir -p /usr/local/etc; \
20+
{ \
21+
echo 'install: --no-document'; \
22+
echo 'update: --no-document'; \
23+
} >> /usr/local/etc/gemrc
24+
25+
ENV LANG C.UTF-8
26+
ENV RUBY_MAJOR 3.0-rc
27+
ENV RUBY_VERSION 3.0.0-preview1
28+
ENV RUBY_DOWNLOAD_SHA256 aa7cce0c99f4ea2145fef9b78d74a44857754396790cd23bad75d759811e7a2a
29+
30+
# some of ruby's build scripts are written in ruby
31+
# we purge system ruby later to make sure our final image uses what we just built
32+
RUN set -eux; \
33+
\
34+
savedAptMark="$(apt-mark showmanual)"; \
35+
apt-get update; \
36+
apt-get install -y --no-install-recommends \
37+
autoconf \
38+
bison \
39+
dpkg-dev \
40+
gcc \
41+
libbz2-dev \
42+
libgdbm-compat-dev \
43+
libgdbm-dev \
44+
libglib2.0-dev \
45+
libncurses-dev \
46+
libreadline-dev \
47+
libxml2-dev \
48+
libxslt-dev \
49+
make \
50+
ruby \
51+
wget \
52+
xz-utils \
53+
; \
54+
rm -rf /var/lib/apt/lists/*; \
55+
\
56+
wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"; \
57+
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
58+
\
59+
mkdir -p /usr/src/ruby; \
60+
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
61+
rm ruby.tar.xz; \
62+
\
63+
cd /usr/src/ruby; \
64+
\
65+
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
66+
# warning: Insecure world writable dir
67+
{ \
68+
echo '#define ENABLE_PATH_CHECK 0'; \
69+
echo; \
70+
cat file.c; \
71+
} > file.c.new; \
72+
mv file.c.new file.c; \
73+
\
74+
autoconf; \
75+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
76+
./configure \
77+
--build="$gnuArch" \
78+
--disable-install-doc \
79+
--enable-shared \
80+
; \
81+
make -j "$(nproc)"; \
82+
make install; \
83+
\
84+
apt-mark auto '.*' > /dev/null; \
85+
apt-mark manual $savedAptMark > /dev/null; \
86+
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
87+
| awk '/=>/ { print $(NF-1) }' \
88+
| sort -u \
89+
| xargs -r dpkg-query --search \
90+
| cut -d: -f1 \
91+
| sort -u \
92+
| xargs -r apt-mark manual \
93+
; \
94+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
95+
\
96+
cd /; \
97+
rm -r /usr/src/ruby; \
98+
# verify we have no "ruby" packages installed
99+
! dpkg -l | grep -i ruby; \
100+
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
101+
# rough smoke test
102+
ruby --version; \
103+
gem --version; \
104+
bundle --version
105+
106+
# don't create ".bundle" in all our apps
107+
ENV GEM_HOME /usr/local/bundle
108+
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
109+
BUNDLE_APP_CONFIG="$GEM_HOME"
110+
ENV PATH $GEM_HOME/bin:$PATH
111+
# adjust permissions of a few directories for running "gem install" as an arbitrary user
112+
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
113+
114+
CMD [ "irb" ]

update.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ rubygems='3.0.3'
2222
declare -A newEnoughRubygems=(
2323
[2.6]=1 # 2.6.3 => gems 3.0.3 (https://github.com/ruby/ruby/blob/v2_6_3/lib/rubygems.rb#L12)
2424
[2.7]=1 # 2.7.0-preview2 => gems 3.1.0.pre1 (https://github.com/ruby/ruby/blob/v2_7_0_preview1/lib/rubygems.rb#L12)
25+
[3.0]=1 # 3.0.0-preview1 => gems 3.2.0.rc.1 (https://github.com/ruby/ruby/blob/v3_0_0_preview1/lib/rubygems.rb#L11)
2526
)
2627
# TODO once all versions are in this family of "new enough", remove RUBYGEMS_VERSION code entirely
2728

0 commit comments

Comments
 (0)