Skip to content

Commit

Permalink
Bump ruby 3.3 to 3.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Dec 31, 2024
1 parent 4cc525e commit 7152721
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ jobs:
ruby/3.2/slim-jammy: 'ruby/3.2/slim-jammy/**'
ruby/3.2/slim-noble: 'ruby/3.2/slim-noble/**'
ruby/3.3/jammy: 'ruby/3.3/jammy/**'
ruby/3.3/noble: 'ruby/3.3/noble/**'
ruby/3.3/slim-jammy: 'ruby/3.3/slim-jammy/**'
ruby/3.3/slim-noble: 'ruby/3.3/slim-noble/**'
shellcheck: 'shellcheck/**'
smokeping: 'smokeping/**'
ubuntu-autoinstall: 'ubuntu-autoinstall/**'
Expand Down
17 changes: 7 additions & 10 deletions ruby/3.3/jammy/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
ARG BASE_IMAGE=docker.io/polymathrobotics/buildpack-deps:jammy
FROM $BASE_IMAGE

# skip installing gem documentation
# skip installing gem documentation with `gem install`/`gem update`
RUN set -eux; \
mkdir -p /usr/local/etc; \
{ \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
echo 'gem: --no-document' >> /usr/local/etc/gemrc

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

# https://www.ruby-lang.org/en/news/2024/09/03/3-3-5-released/
ENV RUBY_VERSION 3.3.5
ENV RUBY_DOWNLOAD_URL https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.5.tar.xz
ENV RUBY_DOWNLOAD_SHA256 51aec7ea89b46125a2c9adc6f36766b65023d47952b916b1aed300ddcc042359
# https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/
ENV RUBY_VERSION=3.3.6
ENV RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.6.tar.xz
ENV RUBY_DOWNLOAD_SHA256=540975969d1af42190d26ff629bc93b1c3f4bffff4ab253e245e125085e66266

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
Expand Down
2 changes: 1 addition & 1 deletion ruby/3.3/jammy/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "TAG_PREFIX" {
}

variable "VERSION" {
default = "3.3.5"
default = "3.3.6"
}

# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux
Expand Down
114 changes: 114 additions & 0 deletions ruby/3.3/noble/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=docker.io/polymathrobotics/buildpack-deps:noble
FROM $BASE_IMAGE

# skip installing gem documentation with `gem install`/`gem update`
RUN set -eux; \
mkdir -p /usr/local/etc; \
echo 'gem: --no-document' >> /usr/local/etc/gemrc

ENV LANG=C.UTF-8

# https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/
ENV RUBY_VERSION=3.3.6
ENV RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.6.tar.xz
ENV RUBY_DOWNLOAD_SHA256=540975969d1af42190d26ff629bc93b1c3f4bffff4ab253e245e125085e66266

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
dpkg-dev \
libgdbm-dev \
ruby \
; \
rm -rf /var/lib/apt/lists/*; \
\
rustArch=; \
dpkgArch="$(dpkg --print-architecture)"; \
case "$dpkgArch" in \
'amd64') rustArch='x86_64-unknown-linux-gnu'; rustupUrl='https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \
'arm64') rustArch='aarch64-unknown-linux-gnu'; rustupUrl='https://static.rust-lang.org/rustup/archive/1.26.0/aarch64-unknown-linux-gnu/rustup-init'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
esac; \
if [ -n "$rustArch" ]; then \
mkdir -p /tmp/rust; \
\
wget -O /tmp/rust/rustup-init "$rustupUrl"; \
echo "$rustupSha256 */tmp/rust/rustup-init" | sha256sum --check --strict; \
chmod +x /tmp/rust/rustup-init; \
\
export RUSTUP_HOME='/tmp/rust/rustup' CARGO_HOME='/tmp/rust/cargo'; \
export PATH="$CARGO_HOME/bin:$PATH"; \
/tmp/rust/rustup-init -y --no-modify-path --profile minimal --default-toolchain '1.74.1' --default-host "$rustArch"; \
\
rustc --version; \
cargo --version; \
fi; \
\
wget -O ruby.tar.xz "$RUBY_DOWNLOAD_URL"; \
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
\
mkdir -p /usr/src/ruby; \
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
rm ruby.tar.xz; \
\
cd /usr/src/ruby; \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
{ \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new; \
mv file.c.new file.c; \
\
autoconf; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
${rustArch:+--enable-yjit} \
; \
make -j "$(nproc)"; \
make install; \
\
rm -rf /tmp/rust; \
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1 || so == "/usr/local/src/ruby/libruby.so.3.3") { next }; gsub("^/(usr/)?", "", so); if (so != "src/ruby/libruby.so.3.3") print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
cd /; \
rm -r /usr/src/ruby; \
# verify we have no "ruby" packages installed
if dpkg -l | grep -i ruby; then exit 1; fi; \
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
# rough smoke test
ruby --version; \
gem --version; \
bundle --version


# don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH $GEM_HOME/bin:$PATH
RUN set -eux; \
mkdir "$GEM_HOME"; \
# adjust permissions of GEM_HOME for running "gem install" as an arbitrary user
chmod 1777 "$GEM_HOME"

CMD [ "irb" ]
40 changes: 40 additions & 0 deletions ruby/3.3/noble/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
variable "TAG_PREFIX" {
default = "docker.io/polymathrobotics/ruby"
}

variable "VERSION" {
default = "3.3.6"
}

# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux
variable "LOCAL_PLATFORM" {
default = regex_replace("${BAKE_LOCAL_PLATFORM}", "^(darwin)", "linux")
}

target "_common" {
dockerfile = "Containerfile"
tags = [
"${TAG_PREFIX}:noble",
"${TAG_PREFIX}:3-noble",
"${TAG_PREFIX}:${VERSION}-noble",
"${TAG_PREFIX}:${join(".", slice(split(".", "${VERSION}"), 0, 2))}-noble",
]
labels = {
"org.opencontainers.image.source" = "https://github.com/polymathrobotics/oci"
"org.opencontainers.image.licenses" = "Apache-2.0"
"org.opencontainers.image.description" = "Ruby is a dynamic, reflective, object-oriented, general-purpose, open-source programming language."
"org.opencontainers.image.title" = "${TAG_PREFIX}"
"org.opencontainers.image.created" = "${timestamp()}"
"dev.polymathrobotics.image.readme-filepath" = "ruby/README.md"
}
}

target "local" {
inherits = ["_common"]
platforms = ["${LOCAL_PLATFORM}"]
}

target "default" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/arm64/v8"]
}
19 changes: 8 additions & 11 deletions ruby/3.3/slim-jammy/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=docker.io/ubuntu:jammy-20240808
ARG BASE_IMAGE=docker.io/ubuntu:jammy-20240911.1
FROM $BASE_IMAGE

RUN set -eux; \
Expand All @@ -16,20 +16,17 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*

# skip installing gem documentation
# skip installing gem documentation with `gem install`/`gem update`
RUN set -eux; \
mkdir -p /usr/local/etc; \
{ \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
echo 'gem: --no-document' >> /usr/local/etc/gemrc

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

# https://www.ruby-lang.org/en/news/2024/09/03/3-3-5-released/
ENV RUBY_VERSION 3.3.5
ENV RUBY_DOWNLOAD_URL https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.5.tar.xz
ENV RUBY_DOWNLOAD_SHA256 51aec7ea89b46125a2c9adc6f36766b65023d47952b916b1aed300ddcc042359
# https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/
ENV RUBY_VERSION=3.3.6
ENV RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.6.tar.xz
ENV RUBY_DOWNLOAD_SHA256=540975969d1af42190d26ff629bc93b1c3f4bffff4ab253e245e125085e66266

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
Expand Down
2 changes: 1 addition & 1 deletion ruby/3.3/slim-jammy/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "TAG_PREFIX" {
}

variable "VERSION" {
default = "3.3.5"
default = "3.3.6"
}

# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux
Expand Down
140 changes: 140 additions & 0 deletions ruby/3.3/slim-noble/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=docker.io/ubuntu:noble-20241118.1
FROM $BASE_IMAGE

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
libffi-dev \
libgmp-dev \
libssl-dev \
libyaml-dev \
procps \
zlib1g-dev \
; \
rm -rf /var/lib/apt/lists/*

# skip installing gem documentation with `gem install`/`gem update`
RUN set -eux; \
mkdir -p /usr/local/etc; \
echo 'gem: --no-document' >> /usr/local/etc/gemrc

ENV LANG=C.UTF-8

# https://www.ruby-lang.org/en/news/2024/11/05/ruby-3-3-6-released/
ENV RUBY_VERSION=3.3.6
ENV RUBY_DOWNLOAD_URL=https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.6.tar.xz
ENV RUBY_DOWNLOAD_SHA256=540975969d1af42190d26ff629bc93b1c3f4bffff4ab253e245e125085e66266

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
dpkg-dev \
libgdbm-dev \
ruby \
autoconf \
g++ \
gcc \
libbz2-dev \
libgdbm-compat-dev \
libglib2.0-dev \
libncurses-dev \
libxml2-dev \
libxslt-dev \
make \
wget \
xz-utils \
; \
rm -rf /var/lib/apt/lists/*; \
\
rustArch=; \
dpkgArch="$(dpkg --print-architecture)"; \
case "$dpkgArch" in \
'amd64') rustArch='x86_64-unknown-linux-gnu'; rustupUrl='https://static.rust-lang.org/rustup/archive/1.26.0/x86_64-unknown-linux-gnu/rustup-init'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \
'arm64') rustArch='aarch64-unknown-linux-gnu'; rustupUrl='https://static.rust-lang.org/rustup/archive/1.26.0/aarch64-unknown-linux-gnu/rustup-init'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
esac; \
\
if [ -n "$rustArch" ]; then \
mkdir -p /tmp/rust; \
\
wget -O /tmp/rust/rustup-init "$rustupUrl"; \
echo "$rustupSha256 */tmp/rust/rustup-init" | sha256sum --check --strict; \
chmod +x /tmp/rust/rustup-init; \
\
export RUSTUP_HOME='/tmp/rust/rustup' CARGO_HOME='/tmp/rust/cargo'; \
export PATH="$CARGO_HOME/bin:$PATH"; \
/tmp/rust/rustup-init -y --no-modify-path --profile minimal --default-toolchain '1.74.1' --default-host "$rustArch"; \
\
rustc --version; \
cargo --version; \
fi; \
\
wget -O ruby.tar.xz "$RUBY_DOWNLOAD_URL"; \
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
\
mkdir -p /usr/src/ruby; \
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
rm ruby.tar.xz; \
\
cd /usr/src/ruby; \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
{ \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new; \
mv file.c.new file.c; \
\
autoconf; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
${rustArch:+--enable-yjit} \
; \
make -j "$(nproc)"; \
make install; \
\
rm -rf /tmp/rust; \
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark > /dev/null; \
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1 || so == "/usr/local/src/ruby/libruby.so.3.3") { next }; gsub("^/(usr/)?", "", so); if (so != "src/ruby/libruby.so.3.3") print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
cd /; \
rm -r /usr/src/ruby; \
# verify we have no "ruby" packages installed
if dpkg -l | grep -i ruby; then exit 1; fi; \
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
# rough smoke test
ruby --version; \
gem --version; \
bundle --version

# don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH $GEM_HOME/bin:$PATH
RUN set -eux; \
mkdir "$GEM_HOME"; \
# adjust permissions of GEM_HOME for running "gem install" as an arbitrary user
chmod 1777 "$GEM_HOME"

CMD [ "irb" ]
Loading

0 comments on commit 7152721

Please sign in to comment.