Skip to content

Commit

Permalink
Rebuild site
Browse files Browse the repository at this point in the history
  • Loading branch information
runner authored and runner committed Feb 5, 2024
1 parent 6e7acd0 commit f8b4ae4
Showing 1 changed file with 50 additions and 82 deletions.
132 changes: 50 additions & 82 deletions docs/individual_assignment3.html
Original file line number Diff line number Diff line change
Expand Up @@ -2503,93 +2503,65 @@ <h1>Individual assignment 3</h1>
<nav class="l-text toc figcaption" id="TOC">
<h3>Contents</h3>
<ul>
<li><a href="#instructions" id="toc-instructions">Instructions</a>
<li><a href="#practice-building-docker-images" id="toc-practice-building-docker-images">Practice building Docker images</a>
<ul>
<li><a href="#submission-instructions" id="toc-submission-instructions">Submission instructions</a></li>
<li><a href="#exercise-instructions" id="toc-exercise-instructions">Exercise instructions</a></li>
<li><a href="#submission-instructions" id="toc-submission-instructions">Submission instructions</a></li>
</ul></li>
<li><a href="#rubric" id="toc-rubric">Rubric</a></li>
</ul>
</nav>
</div>
<h2 id="instructions">Instructions</h2>
<h2 id="practice-building-docker-images">Practice building Docker images</h2>
<p>The purpose of this assignment is to ensure that everyone gains hands-on practice on creating Docker images from <code>Dockerfile</code>s.</p>
<h3 id="submission-instructions">Submission instructions</h3>
<p>In the text box provided for this assignment on Canvas, you must submit:</p>
<ol type="1">
<li>A link to the GitHub.com repository that you create for this assignment.
<ul>
<li>You should name your GitHub.com repository <code>dsci310-dockerfile-practice</code>.</li>
</ul></li>
<li>A the link to your Docker image on DockerHub. You should name your DockerHub repository <code>dsci310-dockerfile-practice</code>.</li>
</ol>
<h3 id="exercise-instructions">Exercise instructions</h3>
<ol type="1">
<li>Create a public repository on GitHub.com repo under your personal username called <code>dsci310-dockerfile-practice</code>
<ul>
<li>You can choose a pre-made <code>.gitignore</code> or manually create one yourself</li>
</ul></li>
<li>Add a <code>Dockerfile</code> to it. This Dockerfile should be based off of the <code>rocker/rstudio:4.1.3</code> Docker image
<li><p>Create a <strong>public</strong> repository on GitHub.com repo under your personal username called <code>dsci310-dockerfile-practice</code>. Select the option to create the repository with a <code>README</code> file.</p></li>
<li><p>Add a <code>Dockerfile</code> to it. This Dockerfile should extend the Jupyter team’s <code>r-notebook</code> image. In particular, the <code>quay.io/jupyter/r-notebook:2023-11-19</code> image. This is the image you should refer to in the <code>FROM</code> statement in your Dockerfile.</p>
<ul>
<li><a href="https://hub.docker.com/r/rocker/rstudio">link to <code>rocker/rstudio</code> DockerHub repository</a></li>
<li><a href="https://hub.docker.com/r/rocker/rstudio/tags?page=1&amp;name=4.1.3">link to <code>rocker/rstudio:4.1.3</code> Dockerfile</a></li>
<li><a href="https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-r-notebook">Docs about the <code>jupyter/minimal-notebook</code> image</a></li>
<li><a href="https://github.com/jupyter/docker-stacks/blob/main/images/minimal-notebook/Dockerfile">link to <code>jupyter/minimal-notebook</code> Dockerfile</a></li>
</ul></li>
<li>Add at least one new R package to the Dockerfile using (ensure that you pin the version of the package you add).
<li><p>Add a Docker <code>RUN</code> command so that at least <strong>two</strong> new Python or R package is installed using <code>conda</code> when the Docker image is built from the <code>Dockerfile</code>. Ensure that you pin the version of the package you add.</p></li>
<li><p>Build your <code>Dockerfile</code> and test it locally.</p></li>
<li><p>Add a GitHub Actions workflow to automatically:</p>
<ul>
<li>There are 2 ways of doing this. There are different benefits to each of the methods depicted. You only need to do one of them for the assignment.</li>
<li>One way is to turn your <code>dsci310-dockerfile-practice</code> into a local RStudio project then do the following steps:
<ol type="1">
<li>Open the RStudio project locally</li>
<li>Initialize the project with renv</li>
<li>Use <code>{renv}</code> to install a package (e.g., <code>cowsay</code>) and then make sure you create a script that loads/uses the <code>{cowsay}</code> package.</li>
<li>In your <code>Dockerfile</code> <code>COPY</code> all your renv files into the container</li>
<li>Use the outputs from <code>renv</code> to help you specify which functions to use to install the libraries</li>
</ol>
<ul>
<li>Hint: you might need to toggle the <code>USER</code> in the <code>Dockerfile</code> between <code>rstudio</code> and <code>root</code> to get everything working.</li>
</ul></li>
<li>Another way is to <code>RUN</code> commands directly in the <code>Dockerfile</code> to install packages
<ul>
<li>Hint: You cannot use <code>install.packages()</code> because you can’t pin a version number.</li>
<li>Hint: You can run R code directly from the command line. For example, <code>Rscript -e "print('something to say...')"</code>. Make sure to change the double quotes <code>""</code> to single quotes <code>''</code> in the R code.<br />
</li>
<li>Hint: You will need to first install the <code>{remotes}</code> package, and then use the <code>remotes::install_version()</code> function</li>
</ul></li>
</ul></li>
<li>Build your <code>Dockerfile</code> and test it locally.</li>
<li>Add a GitHub Actions workflow to automatically build the image, push it to DockerHub,
and version the image and GitHub repo when changes are pushed to the Dockerfile
<ul>
<li>Use the “Docker image” workflow
<li>build the image</li>
<li>push it to DockerHub</li>
<li>version the image and GitHub repo when changes are pushed to the Dockerfile.</li>
</ul>
<p>We recommend doing this by:</p>
<ul>
<li>You can also start off with an empty file and paste in a workflow by clicking “Skip this and setup a workflow yourself”.</li>
<li>by clicking the Actions tab and selecting “Skip this and setup a workflow yourself”</li>
<li>paste this workflow into the empty file: <a href="https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/.github/workflows/docker-publish.yml" class="uri">https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/.github/workflows/docker-publish.yml</a> (also edit the name to edit the name of the file to be <code>docker-publish.yml</code> instead of <code>main.yml</code>).</li>
<li>edit the workflow file on line 32 so that the Docker image will be pushed to your DockerHub user space (and not mine!)</li>
<li>add your DockerHub username and password (naming them <code>DOCKER_USERNAME</code> and <code>DOCKER_PASSWORD</code>, respectively) as GitHub secret (Under Settings &gt; Secrets and variables &gt; Actions &gt; New repository secret) to this repository for this to work.</li>
</ul></li>
<li>You will need to add your DockerHub username and password (naming them <code>DOCKER_USERNAME</code> and <code>DOCKER_PASSWORD</code>, respectively)
as GitHub secrets to this repository for this to work.</li>
<li>Here are some resources to help you create your own Github Action Workflow:
</ol>
<p>(As Needed): Make sure that the GitHub Actions workflow to build and publish the Docker image
get triggered. The <code>docker-publish.yml</code> file can be be triggered by either</p>
<pre><code>- 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).</code></pre>
<ol start="6" type="1">
<li>Add a <code>LICENSE</code> file that attributes the usage of my <code>docker-publish.yml</code>
file in your repository.
This means, you need to copy the <code>LICENSE</code> file contents from
<a href="https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/LICENSE" class="uri">https://github.com/ttimbers/dsci310-dockerfile-practice/blob/main/LICENSE</a>
and include the text in your <code>LICENSE</code> file.
You also want to add a note in that file that this only covers the code you copied from me
(<code>docker-publish.yml</code>).</li>
</ol>
<h3 id="submission-instructions">Submission instructions</h3>
<p>You will submit a PDF to Gradescope for individual assignment 3 that includes:</p>
<ol type="1">
<li>A link to the GitHub.com repository that you create for this assignment.
<ul>
<li>In-class demo on Thursday’s lecture recording, starting 35:00</li>
<li>Github Actions Docker reference: <a href="https://docs.github.com/en/actions/publishing-packages/publishing-docker-images" class="uri">https://docs.github.com/en/actions/publishing-packages/publishing-docker-images</a></li>
</ul></li>
<li>You should name your GitHub.com repository <code>dsci310-dockerfile-practice</code>.</li>
</ul></li>
<li>A the link to your Docker image on DockerHub. You should name your DockerHub repository <code>dsci310-dockerfile-practice</code>.</li>
</ol>
<p>(As Needed): Make sure you make at least one change to the <code>Dockerfile</code> once the GitHub Actions have been setup
so that you get the image automatically built and pushed to DockerHub at least once.
- You can also add a <code>workflow_dispatch:</code> trigger and manually trigger a workflow</p>
<ul>
<li>Note: If you are making an <code>renv.lock</code> file and you notice it’s not updating with <code>renv::snapshot()</code>,
take a look at <a href="https://rstudio.github.io/renv/articles/faq.html#why-isnt-my-package-being-snapshotted-into-the-lockfile">this FAQ</a></li>
</ul>
<h2 id="rubric">Rubric</h2>
<p>This assignment will be graded for completion as follows:</p>
<ol type="1">
<li>A Docker image named <code>dockerfile-practice</code> and tagged with a version exists under the student’s username on DockerHub.</li>
<li>The Dockerfile used to create the Docker image lives in a GitHub repository named <code>dockerfile-practice</code> under the student’s username.</li>
<li>There is evidence that a GitHub Actions workflow can successfully build a Docker image from the Dockerfile in the GitHub repository,
and publish it to DockerHub.</li>
<li><del>The Docker image version tag is in sync with the GitHub repository release tag.</del> (Not needed – Free Point)</li>
<li>At least one new R package was added to the Dockerfile and the version of that package was pinned.</li>
</ol>
<table>
<colgroup>
<col style="width: 5%" />
Expand All @@ -2603,32 +2575,28 @@ <h2 id="rubric">Rubric</h2>
</thead>
<tbody>
<tr class="odd">
<td>100%</td>
<td>5/5 of the criteria listed above were met.</td>
<td>-15%</td>
<td>There were issues with the links submitted that made it difficult to find the GitHub or DockerHub repository</td>
</tr>
<tr class="even">
<td>75%</td>
<td>4/5 of the criteria listed above were met.</td>
<td>-15%</td>
<td>The version is missing from the package that was added to the <code>Dockerfile</code></td>
</tr>
<tr class="odd">
<td>50%</td>
<td>3/5 of the criteria listed above were met.</td>
<td>-33%</td>
<td>No new package was added to the <code>Dockerfile</code></td>
</tr>
<tr class="even">
<td>25%</td>
<td>2/5 of the criteria listed above were met.</td>
<td>-33%</td>
<td>Docker image was not built successfully by GitHub actions and published to DockerHub</td>
</tr>
<tr class="odd">
<td>0%</td>
<td>Only 1/5 of the criteria listed above were met or the assignment was not attempted.</td>
<td>-100%</td>
<td>Assignment was not completed (no GitHub repository was created, or the repository is missing the <code>Dockerfile</code>)</td>
</tr>
</tbody>
</table>
<p>Additional points taken off:</p>
<ul>
<li>-2% for checking in files that are not supposed to be in the repository (temporary system files, thumbnail files, IDE user files, etc)</li>
</ul>
<div class="sourceCode" id="cb1"><pre class="sourceCode r distill-force-highlighting-css"><code class="sourceCode r"></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r distill-force-highlighting-css"><code class="sourceCode r"></code></pre></div>
<!--radix_placeholder_article_footer-->
<!--/radix_placeholder_article_footer-->
</div>
Expand Down

0 comments on commit f8b4ae4

Please sign in to comment.