Skip to content

moritzheiber/ruby-jemalloc-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Docker image, built with jemalloc

A Docker image for Ruby, built with jemalloc.

The images are based on the offical Ruby "slim" and official Ubuntu "22.04"/"24.04" (LTS) images on Docker Hub.

The following images are used:

  • ruby:${RUBY_VERSION}-slim
  • ubuntu:22.04
  • ubuntu:24.04

The following platforms are built:

  • linux/amd64
  • linux/arm64

The following Ruby versions are built:

  • 3.1.4
  • 3.2.3
  • 3.3.0

Images for Ruby >= 3.2.x are compiled with YJIT support.

Container images are available but no longer maintained for the following versions:

  • 3.0.4
  • 3.0.5
  • 3.0.6
  • 3.1.2
  • 3.1.3
  • 3.1.4
  • 3.2.0
  • 3.2.1
  • 3.2.2
  • 3.2.3

and the following platforms:

  • ubuntu-20.04

Support for newer Ruby versions

GitHub Actions is set up to gather the latest available Ruby versions with the ruby-versions-action and feed it to the build process. The plan is to run the build pipeline and update the REAMDE from a template regularly (e.g. weekly) in the future. For now this has to be done manually, so feel free to open a new issue once a new release needs to be supported (it usually takes a few minutes to trigger the pipeline and update the README).

Compiling your own image

The Dockerfile is set up in a way which makes it possible to compile pretty much any recent Ruby release from the index on the ruby-lang.org website. The only two build arguments you need to provide are RUBY_VERSION (e.g. 3.1.2) and the associated sha256 checksum as RUBY_CHECKSUM (e.g. ca10d017f8a1b6d247556622c841fc56b90c03b1803f87198da1e4fd3ec3bf2a) of the tar.gz package associated with the relevant version.

You can always use the ruby-version-checker container to fetch the latest available Ruby releases and their corresponding checksums:

$ docker run ghcr.io/moritzheiber/ruby-version-checker
# [...]
[
  {
    "name": "3.0.6",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.6.tar.gz",
    "sha256": "6e6cbd490030d7910c0ff20edefab4294dfcd1046f0f8f47f78b597987ac683e"
  },
  {
    "name": "3.1.4",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.4.tar.gz",
    "sha256": "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6"
  },
  {
    "name": "3.2.2",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz",
    "sha256": "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
  }
]

If you wish to pass additional compile-time options you can use the build argument ADDITIONAL_FLAGS (e.g. to enable YJIT support for Ruby >= 3.2.x):

$ docker build \
  --build-arg RUBY_VERSION="3.1.4" \
  --build-arg RUBY_CHECKSUM="a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6" \
  --build-arg ADDITIONAL_FLAGS="--enable-yjit" \
  -t ruby-jemalloc:3.1.4-slim .

The Dockerfile uses the official Ruby slim image by default, but you can also use your own base image by passing the build argument IMAGE_NAME:

$ docker build \
  --build-arg RUBY_VERSION=3.1.4 \
  --build-arg RUBY_CHECKSUM=a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6 \
  --build-arg IMAGE_NAME=ubuntu:22.04 \
  -t ruby-jemalloc:3.1.4-ubuntu-22.04 .

Note: Ruby 3.3.1-slim is the default when building the Docker image without any build arguments.

Tests

The tests are run using goss:

dgoss run -ti ruby-jemalloc

You can specify the Ruby version to test for by passing RUBY_VERSION as a variable:

dgoss run -ti -e RUBY_VERSION=3.3.1 ruby-jemalloc

Note: 3.3.1 is the default. And don't forget to also pass the correct RUBY_CHECKSUM.

About

A Ruby Docker image, compiled with jemalloc support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 4

  •  
  •  
  •  
  •