Skip to content

moritzheiber/ruby-jemalloc-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Docker image, built with jemalloc

A Docker image for Ruby, built with jemalloc.

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

The following images are used:

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

The following platforms are built:

  • linux/amd64
  • linux/arm64

The following Ruby versions are built:

  • 3.2.11
  • 3.3.11
  • 3.4.10
  • 4.0.6

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

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

  • 3.2.4
  • 3.2.5
  • 3.2.6
  • 3.2.7
  • 3.2.8
  • 3.3.4
  • 3.3.5
  • 3.3.6
  • 3.3.7
  • 3.3.8
  • 3.4.1
  • 3.4.2
  • 3.4.3
  • 3.4.4
  • 4.0.5

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. 4.0.6) and the associated sha256 checksum as RUBY_CHECKSUM (e.g. 837d299e8f7ddf2be31a229a7a7e019d354979825117989acb3b32b1a9be262a) 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.2.11",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.11.tar.gz",
    "sha256": "b3eeabd6636f334531db3ffdc3229eb05e524740e6c84fdc043720573cf2f8b2"
  },
  {
    "name": "3.3.11",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.11.tar.gz",
    "sha256": "59f0fafb1a59a05dc3765117af3fa68e153eb48254708549f321c1e9e078d7a0"
  },
  {
    "name": "3.4.10",
    "url": "https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.10.tar.gz",
    "sha256": "ecee2d072a14f2d14347dd56dfd8fe5c3130abf5117bfaacbda0f4ef9cc429ec"
  },
  {
    "name": "4.0.6",
    "url": "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.6.tar.gz",
    "sha256": "837d299e8f7ddf2be31a229a7a7e019d354979825117989acb3b32b1a9be262a"
  }
]

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="4.0.6" \
  --build-arg RUBY_CHECKSUM="837d299e8f7ddf2be31a229a7a7e019d354979825117989acb3b32b1a9be262a" \
  --build-arg ADDITIONAL_FLAGS="--enable-yjit" \
  -t ruby-jemalloc:4.0.6-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=4.0.6 \
  --build-arg RUBY_CHECKSUM=837d299e8f7ddf2be31a229a7a7e019d354979825117989acb3b32b1a9be262a \
  --build-arg IMAGE_NAME=ubuntu:22.04 \
  -t ruby-jemalloc:4.0.6-ubuntu-22.04 .

Note: Ruby 4.0.6-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=4.0.6 ruby-jemalloc

Note: 4.0.6 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

20 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors