> For the complete documentation index, see [llms.txt](https://teachersmanual.firstdraft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teachersmanual.firstdraft.com/projects-checklist/adding-dependencies-to-a-project.md).

# Adding Dependencies to a Project

### Prerequisites

* Have Docker installed
* Have a Dockerhub account
* Might be worth reading the [Docker Essentials guide](/docker-essentials.md#docker-essentials) if you're new to Docker.

## Instructions

### Add install instructions to the Dockerfile

For example, to install the `expect` command line tool normally (on Ubuntu), you run this command in the Terminal:

```bash
sudo apt install -y expect
```

To install the tool in the Docker image you can preface the install command with `RUN` to the `Dockerfile`, like this:

```dockerfile
RUN sudo apt install -y expect
```

Once you've added all the dependencies to the `Dockerfile`, you need to re-build the image.

### Re-buildin the image

1. `docker build -t USERNAME/IMAGE_NAME .`
2. `docker push IMAGE_NAME`

Which might look like:

```bash
docker build -t jelaniwoods/my-cool-image
docker push jelaniwoods/my-cool-image
```

### Update gitpod.yml to use new image

Replace the value of the `image` key with the name of the image you pushed in the previous step.

```yml
# .gitpod.yml
image: jelaniwoods/my-cool-image

tasks:
  - before: |
      bin/setup
...
```

### Test new image in Gitpod

* Switch to a new git branch and commit your file changes
* Push branch to GitHub
* Open branch in Gitpod
  * `gitpod.io/#` + GitHub URL for branch
  * You should see Gitpod downloading the newer image
* Verify the new changes work the way you expect
  * There's the correct Ruby version, `rails grade`, `/git` all work, etc
* Merge changes to `main`/`master` branch

That's it!
