> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# cimg/ruby

A  Ruby Docker image built to run on CircleCI that contains ruby, gem and bundle

***This image is designed to supercede the legacy CircleCI Ruby image, `circleci/ruby`.***

`cimg/ruby` is a Docker image created by CircleCI with continuous integration builds in mind.
Each tag contains a complete Ruby version, the `gem` command, Bundler, and any binaries and tools that are required for builds to complete successfully in a CircleCI environment.


## Getting Started

This image can be used with the CircleCI `docker` executor.
For example:

```yaml
jobs:
  build:
    docker:
      - image: cimg/ruby:4.0.5
    steps:
      - checkout
      - run: ruby --version
```

In the above example, the CircleCI Ruby Docker image is used for the primary container.
More specifically, the tag `4.0.5` is used meaning the version of Ruby will be Ruby v4.0.5.
You can now use Ruby within the steps for this job.


## How This Image Works

This image contains the Ruby programming language.
This includes the `gem` command as well as Bundler pre-installed.

### Tagging Scheme

This image has the following tagging scheme:

```
cimg/ruby:<ruby-version>[-variant]
```

`<ruby-version>` - The version of Ruby to use.
This can be a full SemVer point release (such as `2.6.5`) or just the minor release (such as `2.6`).
If you use the minor release tag, it will automatically point to future patch updates as they are released.
For example, the tag `2.6` points to Ruby v2.6.5 now, but when the next release comes out, it will point to Ruby v2.6.6.

`[-variant]` - Variant tags, if available, can optionally be used.
For example, the Node.js variant can be used like this: `cimg/ruby:2.6.5-node`.


## Image Tags


### Variants

Variant images typically contain the same base software, but with a few additional modifications.

#### Node.js

The Node.js variant is the same Ruby image but with Node.js also installed.
The Node.js variant can be used by appending `-node` to the end of an existing `cimg/ruby` tag.

```yaml
jobs:
  build:
    docker:
      - image: cimg/ruby:4.0.5-node
    steps:
      - checkout
      - run: ruby --version
      - run: node --version
```

#### Browsers

The browsers variant is the same Ruby image but with Node.js, Java, Selenium, and browser dependencies pre-installed via apt.
The browsers variant can be used by appending `-browser` to the end of an existing `cimg/ruby` tag.
The browsers variant is designed to work in conjunction with the [CircleCI Browser Tools orb](https://circleci.com/developer/orbs/orb/circleci/browser-tools).
You can use the orb to install a version of Google Chrome and/or Firefox into your build. The image contains all of the supporting tools needed to use both the browser and its driver.

```yaml
orbs:
  browser-tools: circleci/browser-tools@1.1
jobs:
  build:
    docker:
      - image: cimg/ruby:2.7-browsers
    steps:
      - browser-tools/install-browser-tools
      - checkout
      - run: |
          ruby --version
          node --version
          java --version
          google-chrome --version
```
