---
title: CI and Docker
summary: Run installs and tests in a pipeline, use the official Docker image, and set up CommandBox in GitHub Actions.
icon: phosphor-duotone:rocket-launch
tags: [course]
---

Everything you ran by hand works in a pipeline. In this lesson you will see the two commands CI needs, the Docker image, and a GitHub Actions workflow.

## The two commands

```bash
box install
box testbox run
```

`box install` restores the dependencies listed in `box.json`. `box testbox run` runs your suite and returns a failing exit code if any test fails, which fails the build. Any command run as `box <command>` from your native shell passes its exit code straight through.

## Docker

Ortus publishes an official image, `ortussolutions/commandbox`, built from the [docker-commandbox](https://github.com/Ortus-Solutions/docker-commandbox) repository.

```bash
docker pull ortussolutions/commandbox
docker run -p 8080:8080 -p 8443:8443 -v "/path/to/your/app:/app" ortussolutions/commandbox
```

The `/app` folder in the container is the CommandBox working directory. The image listens on 8080 by default, and 8443 for SSL if enabled in your `server.json`. It reads environment variables such as `PORT`, `SSL_PORT`, `CFENGINE` and `HEALTHCHECK_URI`.

!!! tip "Customize it"
    For your own image, use the docker-commandbox repository as the baseline for your Dockerfile.

## GitHub Action

Ortus provides `Ortus-Solutions/setup-commandbox` to install CommandBox on a runner. Minimal usage:

```yaml
- name: Setup CommandBox
  uses: Ortus-Solutions/setup-commandbox@v2.0.0
```

## A workflow

```yaml title=".github/workflows/tests.yml"
name: Tests
on: [push, pull_request]

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup CommandBox
        uses: Ortus-Solutions/setup-commandbox@v2.0.0
      - name: Install dependencies
        run: box install
      - name: Start server
        run: box server start
      - name: Run tests
        run: box testbox run
```

!!! warning "Check the action version"
    Pin the action to a release listed in its README. This workflow assumes your project is set up as in the earlier lessons, with CommandBox running on BoxLang and `testbox-cli` listed in your dependencies.

## Recap

- A pipeline needs `box install` and `box testbox run`, and a red test fails the build.
- The official image is `ortussolutions/commandbox`, with your app mounted at `/app`.
- `Ortus-Solutions/setup-commandbox` installs CommandBox in GitHub Actions.
