Skip to content

Commit 6db728e

Browse files
paihutianon
authored andcommitted
Add YJIT support to debian 3.2+
1 parent 4edf684 commit 6db728e

File tree

5 files changed

+125
-1
lines changed

5 files changed

+125
-1
lines changed

3.2/bullseye/Dockerfile

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

3.2/buster/Dockerfile

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

3.2/slim-bullseye/Dockerfile

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

3.2/slim-buster/Dockerfile

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile.template

+29-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
def should_yjit:
99
# https://github.com/docker-library/ruby/issues/390
1010
([ "2.7", "3.0", "3.1" ] | index(env.version) | not)
11-
and is_alpine
1211
-}}
1312
{{ if is_alpine then ( -}}
1413
FROM alpine:{{ env.variant | ltrimstr("alpine") }}
@@ -106,6 +105,19 @@ RUN set -eux; \
106105
{{ ) else "" end -}}
107106
; \
108107
{{ ) 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 -}}
109121
savedAptMark="$(apt-mark showmanual)"; \
110122
apt-get update; \
111123
apt-get install -y --no-install-recommends \
@@ -130,6 +142,18 @@ RUN set -eux; \
130142
{{ ) else "" end -}}
131143
; \
132144
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 -}}
133157
{{ ) end -}}
134158
\
135159
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; \
211235
| xargs -r apt-mark manual \
212236
; \
213237
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 -}}
214242
{{ ) end -}}
215243
\
216244
cd /; \

0 commit comments

Comments
 (0)