generated from jhudsl/OTTR_Template_Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.Rmd
58 lines (34 loc) · 2.15 KB
/
docker.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "Docker"
output: html_document
---
You might decide to use another package for your website.
If you do so and the rendering does not appear to work like usual, this is because that package is not set up in the Docker image that the website template uses to render the files using GitHub Actions.
## An Example
For example, you might want to add an emoji to your website using the [`emoji` package](https://cran.r-project.org/web/packages/emoji/emoji.pdf).
Note that if you wanted to add an emoji,you could simply copy and paste one from this [website](https://gist.github.com/rxaviers/7360908) and it would work. Like so: 😃
However, we will use this as a simple example to show why you might want to update the Docker image.
Let's say you added the following code to your R Markdown document for one of the website pages:
```{r, fig.align='center', fig.alt= "Page modification", echo = FALSE, out.width="30%"}
knitr::include_graphics("resources/images/emoji.png")
```
This would result in the following rendering issues:
```{r, fig.align='center', fig.alt= "Page modification", echo = FALSE, out.width="70%"}
knitr::include_graphics("resources/images/render_fail.png")
```
With this error:
```{r, fig.align='center', fig.alt= "Page modification", echo = FALSE, out.width="70%"}
knitr::include_graphics("resources/images/render_error.png")
```
So how can we fix this?
You could make a new Docker image that includes the `emoji` package.
## Customizing Docker
If you need to have the rendering of your website done by a customized Docker image, you can [follow these instructions to start your own new docker image](https://www.ottrproject.org/customize-docker.html#Starting_a_new_Docker_image).
In summary, you'll need to:
1. Create a new Dockerfile that begins with:
```
FROM jhudsl/course_template:main
```
So that the OTTR required items are incorporated into your new Docker image.
2. After you successfully build this new docker image, you need to push it to Dockerhub so it can be pulled by the OTTR Github actions.
3. Then, in your `config_automation.yml` file, you need to change the `rendering-docker-image:` spec to be the new docker image's name.