Skip to content

Use Debian's packaged Ruby instead of compiling from source #689

@JamieMagee

Description

@JamieMagee

Problem

The Dockerfile currently compiles Ruby 3.2.2 from source using ruby-build. This takes about 5 minutes and accounts for most of the Docker build time.

curl -L https://github.com/rbenv/ruby-build/archive/refs/tags/v20231012.tar.gz | tar -zxvf - -C /tmp/ && \
cd /tmp/ruby-build-* && ./install.sh && cd / && \
ruby-build -v 3.2.2 /usr/local && rm -rfv /tmp/ruby-build-*

Why we don't need to do this

Ruby is only used to run Licensee (the license detection tool). Licensee 9.16.1 requires Ruby >= 3.0.

Debian Trixie (our base image node:24-trixie) ships with Ruby 3.3, which satisfies this requirement.

Proposed change

Replace the ruby-build compilation with:

apt-get install -y ruby ruby-dev

Build time comparison

Build Time
Before (compile from source) 6m 28s
After (Debian package) 4m 5s
Saved 2m 23s (37%)

The Ruby installation step specifically went from ~5 minutes to ~14 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions