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

# cimg/clojure

A Clojure Docker image built to run on CircleCI that contains prebuilt OpenJDK, Clojure via clj and Leiningen.

***This image is designed to supercede the original CircleCI Clojure image, `circleci/clojure`.***

`cimg/clojure` is a Docker image created by CircleCI with continuous integration builds in mind.
Each tag contains a Clojure version, a JVM, 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/clojure:1.12.0-openjdk-8.0-node
    steps:
      - checkout
      - run: lein version
```

In the above example, the CircleCI Clojure Docker image is used for the primary container.
More specifically, the tag `1.12.0-openjdk-8.0-node` is used meaning the version of Clojure will be Clojure v1.12.0-openjdk-8.0-node.
You can now use Clojure within the steps for this job.


## How This Image Works

This image contains the Clojure programming language as installed via clj as well as [Leiningen](https://leiningen.org/).
These Clojure images contain OpenJDK with support for v8, v11, v17

Babashka is pre-installed.
Please note that Babashka has frequent releases while CircleCI only releases Clojure images as the upstream project makes a release.
There will be times were the pre-installed version of Babashka is older than you might want.

### Tagging Scheme

This image has the following tagging schemes:

Standard tagging. This scheme will point to a specified default version of OpenJDK, which is currently `17.0`
```
cimg/clojure:<clojure-version>[-variant]
```

Specific OpenJDK support:
```
cimg/clojure:<clojure-version>-<openjdk-version>[-variant]
```

`<clojure-version>` - The version of Clojure to use.
This can be a full SemVer point release (such as `1.10.1`) or just the minor release (such as `1.10`).
If you use the minor release tag, it will automatically point to future patch updates as they are released by the Clojure Team.
For example, the tag `1.10` points to Clojure v1.10.1 now, but when the next release comes out, it will point to Clojure v1.10.2.

`<openjdk-version>` - The version of OpenJDK to use.
This portion of the tag only uses major.minor syntax, but is built from the corresponding openjdk image found [here](https://github.com/CircleCI-Public/cimg-openjdk) (like `17.0`).

`[-variant]` - Variant tags can optionally be used like this. With the `node` variant for example, it could be used like this: `cimg/clojure:1.10-node` or `cimg/clojure:1.10-openjdk-17-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 Clojure image but with Node.js also installed.
The Node.js variant can be used by appending `-node` to the end of an existing `cimg/clojure` tag.

```yaml
jobs:
  build:
    docker:
      - image: cimg/clojure:1.10.3-node
    steps:
      - checkout
      - run: node --version
```

#### Browsers

The browsers variant is the same Clojure image but with Node.js, Selenium, and browser dependencies pre-installed via apt.
The browsers variant can be used by appending `-browser` to the end of an existing `cimg/clojure` 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/clojure:1.10.3-browsers
    steps:
      - browser-tools/install-browser-tools
      - checkout
      - run: |
          node --version
          google-chrome --version
```
