Adding Dependencies to a Project

Prerequisites

  • Have Docker installed

  • Have a Dockerhub account

  • Might be worth reading the Docker Essentials guide 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:

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:

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:

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.

# .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!

Last updated