Skip to content

Commit b0c1b3c

Browse files
committed
Add 2.7.0-preview1
1 parent 9ae0943 commit b0c1b3c

File tree

5 files changed

+302
-2
lines changed

5 files changed

+302
-2
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ language: bash
22
services: docker
33

44
env:
5+
- VERSION=2.7-rc VARIANT=stretch
6+
- VERSION=2.7-rc VARIANT=stretch/slim
7+
- VERSION=2.7-rc VARIANT=alpine3.9
58
- VERSION=2.6 VARIANT=stretch
69
- VERSION=2.6 VARIANT=stretch/slim
710
- VERSION=2.6 VARIANT=alpine3.9

2.7-rc/alpine3.9/Dockerfile

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

2.7-rc/stretch/Dockerfile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM buildpack-deps:stretch
2+
3+
# skip installing gem documentation
4+
RUN mkdir -p /usr/local/etc \
5+
&& { \
6+
echo 'install: --no-document'; \
7+
echo 'update: --no-document'; \
8+
} >> /usr/local/etc/gemrc
9+
10+
ENV RUBY_MAJOR 2.7-rc
11+
ENV RUBY_VERSION 2.7.0-preview1
12+
ENV RUBY_DOWNLOAD_SHA256 8c546df3345398b3edc9d0ab097846f033783d33762889fd0f3dc8bb465c3354
13+
14+
# some of ruby's build scripts are written in ruby
15+
# we purge system ruby later to make sure our final image uses what we just built
16+
RUN set -ex \
17+
\
18+
&& buildDeps=' \
19+
bison \
20+
dpkg-dev \
21+
libgdbm-dev \
22+
ruby \
23+
' \
24+
&& apt-get update \
25+
&& apt-get install -y --no-install-recommends $buildDeps \
26+
&& rm -rf /var/lib/apt/lists/* \
27+
\
28+
&& wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
29+
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \
30+
\
31+
&& mkdir -p /usr/src/ruby \
32+
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
33+
&& rm ruby.tar.xz \
34+
\
35+
&& cd /usr/src/ruby \
36+
\
37+
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
38+
# warning: Insecure world writable dir
39+
&& { \
40+
echo '#define ENABLE_PATH_CHECK 0'; \
41+
echo; \
42+
cat file.c; \
43+
} > file.c.new \
44+
&& mv file.c.new file.c \
45+
\
46+
&& autoconf \
47+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
48+
&& ./configure \
49+
--build="$gnuArch" \
50+
--disable-install-doc \
51+
--enable-shared \
52+
&& make -j "$(nproc)" \
53+
&& make install \
54+
\
55+
&& apt-get purge -y --auto-remove $buildDeps \
56+
&& cd / \
57+
&& rm -r /usr/src/ruby \
58+
# rough smoke test
59+
&& ruby --version && gem --version && bundle --version
60+
61+
# install things globally, for great justice
62+
# and don't create ".bundle" in all our apps
63+
ENV GEM_HOME /usr/local/bundle
64+
ENV BUNDLE_PATH="$GEM_HOME" \
65+
BUNDLE_SILENCE_ROOT_WARNING=1 \
66+
BUNDLE_APP_CONFIG="$GEM_HOME"
67+
# path recommendation: https://github.com/bundler/bundler/pull/6469#issuecomment-383235438
68+
ENV PATH $GEM_HOME/bin:$BUNDLE_PATH/gems/bin:$PATH
69+
# adjust permissions of a few directories for running "gem install" as an arbitrary user
70+
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
71+
# (BUNDLE_PATH = GEM_HOME, no need to mkdir/chown both)
72+
73+
CMD [ "irb" ]

2.7-rc/stretch/slim/Dockerfile

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

update.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ latest_gem_version() {
2020
# https://github.com/docker-library/ruby/issues/246
2121
rubygems='3.0.3'
2222
declare -A newEnoughRubygems=(
23-
[2.6]=1 # 2.6.2 => gems 3.0.3
23+
[2.6]=1 # 2.6.3 => gems 3.0.3 (https://github.com/ruby/ruby/blob/v2_6_3/lib/rubygems.rb#L12)
24+
[2.7]=1 # 2.7.0-preview1 => gems 3.1.0.pre1 (https://github.com/ruby/ruby/blob/v2_7_0_preview1/lib/rubygems.rb#L12)
2425
)
2526
# TODO once all versions are in this family of "new enough", remove RUBYGEMS_VERSION code entirely
2627

@@ -104,7 +105,7 @@ for version in "${versions[@]}"; do
104105
;;
105106
esac
106107

107-
if [ -n "${newEnoughRubygems[$version]:-}" ]; then
108+
if [ -n "${newEnoughRubygems[$rcVersion]:-}" ]; then
108109
sed -ri -e '/RUBYGEMS_VERSION/d' "$dir/Dockerfile"
109110
fi
110111

0 commit comments

Comments
 (0)