Individual assignment 3

Practice building Docker images

The purpose of this assignment is to ensure that everyone gains hands-on practice on creating Docker images from Dockerfiles.

Exercise instructions

  1. Create a public repository on GitHub.com repo under your personal username called dsci310-dockerfile-practice. Select the option to create the repository with a README file.

  2. Add a Dockerfile to it. This Dockerfile should extend the Jupyter team’s r-notebook image. In particular, the quay.io/jupyter/r-notebook:2023-11-19 image. This is the image you should refer to in the FROM statement in your Dockerfile.

  3. Add a Docker RUN command so that at least two new Python or R package is installed using conda when the Docker image is built from the Dockerfile. Ensure that you pin the version of the package you add.

  4. Build your Dockerfile and test it locally.

  5. Add a GitHub Actions workflow to automatically:

    • build the image
    • push it to DockerHub
    • version the image and GitHub repo when changes are pushed to the Dockerfile.

    We recommend doing this by:

    • by clicking the Actions tab and selecting “Skip this and setup a workflow yourself”

    • paste this workflow into the empty file: https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/.github/workflows/docker-publish.yml (also edit the name to edit the name of the file to be docker-publish.yml instead of main.yml).

    • edit the workflow file on line 32 so that the Docker image will be pushed to your DockerHub user space (and not mine!)

    • add your DockerHub username and password (naming them DOCKER_USERNAME and DOCKER_PASSWORD, respectively) as GitHub secret (Under Settings > Secrets and variables > Actions > New repository secret) to this repository for this to work.

    • (As Needed): Make sure that the GitHub Actions workflow to build and publish the Docker image get triggered. The docker-publish.yml file can be be triggered by either:

      • pushing a commit that changes the Dockerfile, or
      • clicking on the Actions tab, and then click on the workflow .github/workflows/docker-publish.yml. You then should see a “Run workflow” button with a drop down menu, from that menu select “Run workflow” (this will trigger GitHub Actions to create a commit in your remote repository).
  6. Add a LICENSE file that attributes the usage of my docker-publish.yml file in your repository. This means, you need to copy the LICENSE file contents from https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/LICENSE and include the text in your LICENSE file. You also want to add a note in that file that this only covers the code you copied from me (docker-publish.yml).

Submission instructions

You will submit a PDF to Gradescope for individual assignment 3 that includes:

  1. A link to the GitHub.com repository that you create for this assignment.
    • You should name your GitHub.com repository dsci310-dockerfile-practice.
  2. A the link to your Docker image on DockerHub. You should name your DockerHub repository dsci310-dockerfile-practice.

Rubric

This assignment will be graded for completion as follows:

Grade Description
-15% There were issues with the links submitted that made it difficult to find the GitHub or DockerHub repository
-15% The version is missing from the package that was added to the Dockerfile
-15% There were authentication issues with publishing to Docker Hub.
-33% No new package was added to the Dockerfile
-33% Docker image was not built successfully by GitHub actions and published to DockerHub
-100% Assignment was not completed (no GitHub repository was created, or the repository is missing the Dockerfile)