From c8837e7516c92650d35d28afdd791c986c415cba Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Thu, 1 Dec 2022 20:57:42 -0300 Subject: [PATCH] Update Ruby to 3.2 --- image/base/install-ruby | 7 ++++++- image/base/install-rust | 28 ++++++++++++++++++++++++++++ image/base/slim.Dockerfile | 12 +++++++++--- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100755 image/base/install-rust diff --git a/image/base/install-ruby b/image/base/install-ruby index 0c77c18..73de467 100755 --- a/image/base/install-ruby +++ b/image/base/install-ruby @@ -1,7 +1,10 @@ #!/bin/bash set -e -RUBY_VERSION="2.7.6" +RUBY_VERSION="3.2.0-dev" +export CONFIGURE_OPTS="--enable-yjit" + +apt-get -y install --no-install-recommends ruby bison mkdir /src git -C /src clone https://github.com/rbenv/ruby-build.git @@ -9,3 +12,5 @@ cd /src/ruby-build && ./install.sh cd / && rm -fr /src ruby-build ${RUBY_VERSION} /usr/local + +apt-get -y purge ruby diff --git a/image/base/install-rust b/image/base/install-rust new file mode 100755 index 0000000..0d5a36a --- /dev/null +++ b/image/base/install-rust @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +export RUSTUP_HOME=/usr/local/rustup +export CARGO_HOME=/usr/local/cargo +export PATH=/usr/local/cargo/bin:$PATH +export RUST_VERSION=1.65.0 + +dpkgArch="$(dpkg --print-architecture)" + +case "${dpkgArch##*-}" in + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='48c5ecfd1409da93164af20cf4ac2c6f00688b15eb6ba65047f654060c844d85' ;; + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0e0be29c560ad958ba52fcf06b3ea04435cb3cd674fbe11ce7d954093b9504fd' ;; + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; +esac + +url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init" +wget "$url" +echo "${rustupSha256} *rustup-init" | sha256sum -c - +chmod +x rustup-init +./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch} +rm rustup-init +chmod -R a+w $RUSTUP_HOME $CARGO_HOME +rustup --version +cargo --version +rustc --version diff --git a/image/base/slim.Dockerfile b/image/base/slim.Dockerfile index 1fba35b..f65d804 100644 --- a/image/base/slim.Dockerfile +++ b/image/base/slim.Dockerfile @@ -2,9 +2,12 @@ # VERSION: release FROM debian:bullseye-slim -ENV PG_MAJOR 13 -ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1 -ENV RAILS_ENV production +ENV PG_MAJOR=13 \ + RUBY_ALLOCATOR=/usr/lib/libjemalloc.so.1 \ + RAILS_ENV=production \ + RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH #LABEL maintainer="Sam Saffron \"https://twitter.com/samsaffron\"" @@ -72,6 +75,9 @@ RUN /tmp/install-oxipng ADD install-redis /tmp/install-redis RUN /tmp/install-redis +ADD install-rust /tmp/install-rust +RUN /tmp/install-rust + ADD install-ruby /tmp/install-ruby RUN /tmp/install-ruby -- 2.25.1