Update Ruby to 3.2
authorRafael dos Santos Silva <xfalcox@gmail.com>
Thu, 1 Dec 2022 23:57:42 +0000 (20:57 -0300)
committerRafael dos Santos Silva <xfalcox@gmail.com>
Tue, 20 Dec 2022 20:37:35 +0000 (17:37 -0300)
image/base/install-ruby
image/base/install-rust [new file with mode: 0755]
image/base/slim.Dockerfile

index 0c77c181e6782e4b21ab2629488e086a66697cd4..73de46754c6903b19c2937c8d9e9f676ff6dcc53 100755 (executable)
@@ -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 (executable)
index 0000000..0d5a36a
--- /dev/null
@@ -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
index 1fba35b1f75183fcf45174af9a09d30d681795da..f65d8046ee1d83de027ac312d7996ed16a76e1f8 100644 (file)
@@ -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