8
8
def should_yjit:
9
9
# https://github.com/docker-library/ruby/issues/390
10
10
([ "2.7", "3.0", "3.1" ] | index(env.version) | not)
11
- and is_alpine
12
11
-}}
13
12
{{ if is_alpine then ( -}}
14
13
FROM alpine:{{ env.variant | ltrimstr("alpine") }}
@@ -106,6 +105,19 @@ RUN set -eux; \
106
105
{{ ) else "" end -}}
107
106
; \
108
107
{{ ) else ( -}}
108
+ {{ if should_yjit then ( -}}
109
+ yjit=; \
110
+ debArch="$(uname -m)"; \
111
+ \
112
+ export RUSTUP_HOME=/tmp/rustup; \
113
+ export CARGO_HOME=/tmp/cargo; \
114
+ PATH=$CARGO_HOME/bin:$PATH; \
115
+ rustArch=${debArch}-unknown-linux-gnu; \
116
+ case "$debArch" in \
117
+ x86_64) yjit=1; RUST_VERSION=1.66; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
118
+ aarch64) yjit=1; RUST_VERSION=1.66; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929';; \
119
+ esac; \
120
+ {{ ) else "" end -}}
109
121
savedAptMark="$(apt-mark showmanual)"; \
110
122
apt-get update; \
111
123
apt-get install -y --no-install-recommends \
@@ -130,6 +142,18 @@ RUN set -eux; \
130
142
{{ ) else "" end -}}
131
143
; \
132
144
rm -rf /var/lib/apt/lists/*; \
145
+ {{ if should_yjit then ( -}}
146
+ \
147
+ case "$yjit" in \
148
+ 1) wget https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init; \
149
+ echo "${rustupSha256} *rustup-init" | sha256sum --check --strict; \
150
+ chmod +x rustup-init; \
151
+ ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
152
+ rm rustup-init; \
153
+ cargo --version; \
154
+ rustc --version ;; \
155
+ esac; \
156
+ {{ ) else "" end -}}
133
157
{{ ) end -}}
134
158
\
135
159
wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"; \
@@ -211,6 +235,10 @@ RUN set -eux; \
211
235
| xargs -r apt-mark manual \
212
236
; \
213
237
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
238
+ {{ if should_yjit then ( -}}
239
+ rm -rf $RUSTUP_HOME; \
240
+ rm -rf $CARGO_HOME; \
241
+ {{ ) else "" end -}}
214
242
{{ ) end -}}
215
243
\
216
244
cd /; \
0 commit comments