@@ -31,14 +31,17 @@ For those new to Docker, here's a quick overview of relevant terms:
3131
3232You can install the development version of ` dockitect ` from GitHub:
3333
34- ``` {r installation, eval=FALSE}
34+ ``` {r}
35+ #| label: installation
36+ #| eval: false
3537# install.packages("remotes")
3638remotes::install_github("coatless-rpkg/dockitect")
3739```
3840
3941Let's start by loading the package:
4042
41- ``` {r setup}
43+ ``` {r}
44+ #| label: setup
4245library(dockitect)
4346```
4447
@@ -63,7 +66,8 @@ to it through a series of pipe operations.
6366
6467Start by creating a new Dockerfile object:
6568
66- ``` {r dockerfile-object}
69+ ``` {r}
70+ #| label: dockerfile-object-init
6771# Create a new Dockerfile object
6872df <- dockerfile()
6973print(df)
@@ -76,10 +80,11 @@ Congratulations! You've created your first (empty) Dockerfile object. Now let's
7680To add instructions to the Dockerfile, use the ` dfi_*() ` functions. For example,
7781to set the base image:
7882
79- ``` {r basic-dockerfile}
83+ ``` {r}
84+ #| label: basic-dockerfile-with-from
8085# Create a Dockerfile for an R script
8186df <- dockerfile() |>
82- dfi_from("rocker/r-ver:4.4.0") |> # Base image with R 4.4.0
87+ dfi_from("rocker/r-ver:4.4.0") # Base image with R 4.4.0
8388```
8489
8590You can print the Dockerfile to see the added instruction:
@@ -91,7 +96,8 @@ print(df)
9196Usually, you'll add multiple instructions to the Dockerfile. Let's add a few more
9297instructions to the Dockerfile so that we can run a script:
9398
94- ``` {r basic-dockerfile}
99+ ``` {r}
100+ #| label: basic-dockerfile-full
95101# Create a Dockerfile for an R script
96102df <- dockerfile() |>
97103 dfi_from("rocker/r-ver:4.4.0") |> # Base image with R 4.4.0
@@ -116,7 +122,8 @@ This example shows the most common Docker instructions:
116122
117123For ` RUN ` instructions with multiple commands, you can pass a character vector:
118124
119- ``` {r run-multiple}
125+ ``` {r}
126+ #| label: dockerfile-run-multiple-commands
120127dockerfile() |>
121128 dfi_from("rocker/r-ver:4.4.0") |>
122129 dfi_run(c(
0 commit comments