-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
155 lines (129 loc) · 4.57 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
ARG os=debian
ARG version=bullseye
ARG variant=-slim
ARG mirror=http://deb.debian.org/debian
ARG system_ruby=ruby2.7
# Build for 0.*, 1.0*, 1.1*, 1.8 and 1.8.5
FROM debian:buster-slim
ENV DEBIAN_FRONTEND=noninteractive
ARG mirror
RUN dpkg --add-architecture i386 \
&& echo "deb-src ${mirror} buster main" > /etc/apt/sources.list.d/deb-src.list \
&& echo 'Dpkg::Use-Pty "0";\nquiet "2";\nAPT::Install-Recommends "0";' > /etc/apt/apt.conf.d/99autopilot \
&& echo 'Acquire::HTTP::No-Cache "True";' > /etc/apt/apt.conf.d/99no-cache \
&& apt-get update \
&& apt-get install \
build-essential \
gcc-multilib \
bison \
rdfind \
file \
libruby2.5:amd64 \
libruby2.5:i386 \
&& apt-get build-dep ruby2.5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /all-ruby
COPY Rakefile /all-ruby/
COPY lib/ruby_version.rb /all-ruby/lib/
COPY patch /all-ruby/patch/
RUN rake setup_build
# rake -j interpret non-numeric argument as number of CPUs plus 3.
ARG j=numcpu_plus_alpha
COPY versions/0.* versions/1.* versions/2.0.0* /all-ruby/versions/
RUN rake -j ${j} all-0 all-1.0 all-1.1a all-1.1b all-1.1c all-1.1d all-1.8 all-1.8.5
RUN rake -j ${j} all-2.0.0
RUN rm -rf Rakefile versions/ patch/
RUN rm -rf DIST build/*/log build/*/ruby*/
RUN rm -rf build/*/man build/*/share/man build/*/share/doc build/*/share/ri
RUN rm -f build/*/lib/libruby-static.a
RUN rm -f build/*/bin/gcc build/*/bin/cc
FROM ${os}:${version}${variant}
ENV DEBIAN_FRONTEND=noninteractive
ARG mirror
ARG version
ARG system_ruby
RUN dpkg --add-architecture i386 \
&& echo "deb-src ${mirror} ${version} main" > /etc/apt/sources.list.d/deb-src.list \
&& echo 'Dpkg::Use-Pty "0";\nquiet "2";\nAPT::Install-Recommends "0";' > /etc/apt/apt.conf.d/99autopilot \
&& echo 'Acquire::HTTP::No-Cache "True";' > /etc/apt/apt.conf.d/99no-cache \
&& apt-get update \
&& apt-get install \
build-essential \
gcc-multilib \
bison \
rdfind \
file \
lib${system_ruby}:amd64 \
lib${system_ruby}:i386 \
&& apt-get build-dep ${system_ruby} \
&& rm -rf /var/lib/apt/lists/*
COPY --from=0 /build-all-ruby/ /build-all-ruby
COPY --from=0 /all-ruby/ /all-ruby
WORKDIR /all-ruby
COPY Rakefile /all-ruby/
COPY lib/ruby_version.rb /all-ruby/lib/
COPY patch /all-ruby/patch/
RUN rake setup_build
# rake -j interpret non-numeric argument as number of CPUs plus 3.
ARG j=numcpu_plus_alpha
COPY versions/1.* versions/2.1* versions/2.2* versions/2.3* versions/2.4* versions/2.5* versions/2.6* versions/2.7* versions/3.0* /all-ruby/versions/
RUN rake -j ${j} all-1.2 all-1.3 all-1.4 all-1.6 all-1.8.6 all-1.8.7
RUN rake -j ${j} all-1.9.0 all-1.9.1 all-1.9.2
RUN rake -j ${j} all-1.9.3
RUN rake -j ${j} all-2.1
RUN rake -j ${j} all-2.2
RUN rake -j ${j} all-2.3
RUN rake -j ${j} all-2.4
RUN rake -j ${j} all-2.5
RUN rake -j ${j} all-2.6
RUN rake -j ${j} all-2.7
RUN rake -j ${j} all-3.0
COPY versions/3.1* /all-ruby/versions/
RUN rake -j ${j} all-3.1
COPY versions/3.2* /all-ruby/versions/
RUN rake -j ${j} all-3.2
COPY versions/3.3* /all-ruby/versions/
RUN rake -j ${j} all-3.3
COPY versions/3.4* /all-ruby/versions/
RUN rake -j ${j} all-3.4
COPY lib/* /all-ruby/lib/
COPY all-ruby /all-ruby/
RUN rm -rf Rakefile versions/ patch/
RUN rm -rf DIST build/*/log build/*/ruby*/
RUN rm -rf build/*/man build/*/share/man build/*/share/doc build/*/share/ri
RUN rm -f build/*/lib/libruby-static.a
RUN rm -f build/*/bin/gcc build/*/bin/cc
RUN find /build-all-ruby -type f \( -name ruby -o -name '*.so' \) -exec sh -c 'file $1 | grep -q "not stripped"' - '{}' \; -print0 | xargs -0 strip
RUN rdfind -makehardlinks true -makeresultsfile false /build-all-ruby
FROM ${os}:${version}${variant}
ENV DEBIAN_FRONTEND=noninteractive
ARG mirror
ARG version
ARG system_ruby
# gcc is required for mjit of ruby 2.6
RUN dpkg --add-architecture i386 \
&& echo "deb-src ${mirror} ${version} main" > /etc/apt/sources.list.d/deb-src.list \
&& echo 'Dpkg::Use-Pty "0";\nquiet "2";\nAPT::Install-Recommends "0";' > /etc/apt/apt.conf.d/99autopilot \
&& echo 'Acquire::HTTP::No-Cache "True";' > /etc/apt/apt.conf.d/99no-cache \
&& apt-get update \
&& apt-get install \
libc6:i386 \
libffi7:i386 \
libgcc1:i386 \
libgdbm6:i386 \
libncurses5:i386 \
libreadline8:i386 \
libssl1.1:i386 \
zlib1g:i386 \
libffi7:amd64 \
libgdbm6:amd64 \
libncurses5:amd64 \
libreadline8:amd64 \
libssl1.1:amd64 \
zlib1g:amd64 \
gcc \
${system_ruby} \
&& rm -rf /var/lib/apt/lists/*
COPY --from=1 /build-all-ruby/ /build-all-ruby
COPY --from=1 /all-ruby/ /all-ruby
WORKDIR /all-ruby