Skip to content

Commit 39928d0

Browse files
committed
doc: rebuild the README
1 parent a7fd33c commit 39928d0

File tree

2 files changed

+77
-124
lines changed

2 files changed

+77
-124
lines changed

README.Rmd

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ output: github_document
66

77
```{r setup, include = FALSE}
88
knitr::opts_chunk$set(
9+
eval = FALSE,
910
collapse = TRUE,
1011
comment = "#>",
1112
fig.path = "man/figures/README-",
@@ -21,7 +22,21 @@ knitr::opts_chunk$set(
2122

2223
# `{dockerfiler}`
2324

24-
Easy Dockerfile Creation from R.
25+
The goal of `{dockerfiler}` is to provide an easy way to create Dockerfiles from R.
26+
27+
## About
28+
29+
You're reading the doc about version :
30+
31+
```{r eval = TRUE}
32+
desc::desc_get_version()
33+
```
34+
35+
The check results are:
36+
37+
```{r eval = TRUE}
38+
devtools::check(quiet = TRUE)
39+
```
2540

2641
## Installation
2742

@@ -32,13 +47,13 @@ You can install dockerfiler from GitHub with:
3247
remotes::install_github("ThinkR-open/dockerfiler")
3348
```
3449

35-
Or from CRAN with :
50+
Or from CRAN with :
3651

3752
```{r, eval = FALSE}
3853
install.packages("dockerfiler")
3954
```
4055

41-
## Basic worflow
56+
## Basic worflow
4257

4358
By default, Dockerfiles are created with `FROM "rocker/r-base"`.
4459

@@ -68,21 +83,21 @@ my_dock$EXPOSE(8000)
6883
my_dock$CMD("Rscript /usr/scripts/torun.R ")
6984
```
7085

71-
See your Dockerfile :
86+
See your Dockerfile :
7287

7388
```{r}
7489
my_dock
7590
```
7691

77-
If you've made a mistake in your script, you can switch lines with the `switch_cmd` method. This function takes as arguments the positions of the two cmd you want to switch :
92+
If you've made a mistake in your script, you can switch lines with the `switch_cmd` method. This function takes as arguments the positions of the two cmd you want to switch :
7893

7994
```{r}
8095
# Switch line 8 and 7
8196
my_dock$switch_cmd(8, 7)
8297
my_dock
8398
```
8499

85-
You can also remove a cmd with `remove_cmd`:
100+
You can also remove a cmd with `remove_cmd`:
86101

87102
```{r}
88103
my_dock$remove_cmd(8)
@@ -96,11 +111,11 @@ my_dock$remove_cmd(5:7)
96111
my_dock
97112
```
98113

99-
`add_after` add a command after a given line.
114+
`add_after` add a command after a given line.
100115

101116
```{r}
102117
my_dock$add_after(
103-
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
118+
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
104119
after = 3
105120
)
106121
```
@@ -112,7 +127,7 @@ Save your Dockerfile:
112127
my_dock$write()
113128
```
114129

115-
## Create a Dockerfile from a DESCRIPTION
130+
## Create a Dockerfile from a DESCRIPTION
116131

117132
You can use a DESCRIPTION file to create a Dockerfile that installs the dependencies and the package.
118133

@@ -123,7 +138,7 @@ my_dock
123138
my_dock$CMD(r(library(dockerfiler)))
124139
125140
my_dock$add_after(
126-
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
141+
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
127142
after = 3
128143
)
129144
my_dock
@@ -141,23 +156,29 @@ the_lockfile <- file.path(dir_build, "renv.lock")
141156
custom_packages <- c(
142157
# attachment::att_from_description(),
143158
"renv",
144-
"cli", "glue", "golem",
145-
"shiny", "stats", "utils",
159+
"cli",
160+
"glue",
161+
"golem",
162+
"shiny",
163+
"stats",
164+
"utils",
146165
"testthat",
147166
"knitr"
148167
)
149168
renv::snapshot(
150169
packages = custom_packages,
151170
lockfile = the_lockfile,
152-
prompt = FALSE)
171+
prompt = FALSE
172+
)
153173
```
154174

155175
- Build Dockerfile
156176
```{r}
157-
my_dock <- dock_from_renv(lockfile = the_lockfile,
158-
distro = "focal",
159-
FROM = "rocker/verse"
160-
)
177+
my_dock <- dock_from_renv(
178+
lockfile = the_lockfile,
179+
distro = "focal",
180+
FROM = "rocker/verse"
181+
)
161182
my_dock
162183
```
163184

README.md

Lines changed: 39 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,28 @@ status](https://codecov.io/gh/ThinkR-open/dockerfiler/branch/master/graph/badge.
99

1010
# `{dockerfiler}`
1111

12-
Easy Dockerfile Creation from R.
12+
The goal of `{dockerfiler}` is to provide an easy way to create
13+
Dockerfiles from R.
14+
15+
## About
16+
17+
You’re reading the doc about version :
18+
19+
``` r
20+
desc::desc_get_version()
21+
#> [1] '0.2.1'
22+
```
23+
24+
The check results are:
25+
26+
``` r
27+
devtools::check(quiet = TRUE)
28+
#> ℹ Loading dockerfiler
29+
#> ── R CMD check results ────────────────────────────────── dockerfiler 0.2.1 ────
30+
#> Duration: 48.4s
31+
#>
32+
#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
33+
```
1334

1435
## Installation
1536

@@ -61,15 +82,6 @@ See your Dockerfile :
6182

6283
``` r
6384
my_dock
64-
#> FROM rocker/r-base
65-
#> MAINTAINER Colin FAY <contact@colinfay.me>
66-
#> RUN R -e 'install.packages("attempt", repo = "http://cran.irsn.fr/")'
67-
#> RUN mkdir /usr/scripts
68-
#> RUN cd /usr/scripts
69-
#> COPY plumberfile.R /usr/scripts/plumber.R
70-
#> COPY torun.R /usr/scripts/torun.R
71-
#> EXPOSE 8000
72-
#> CMD Rscript /usr/scripts/torun.R
7385
```
7486

7587
If you’ve made a mistake in your script, you can switch lines with the
@@ -80,49 +92,27 @@ the two cmd you want to switch :
8092
# Switch line 8 and 7
8193
my_dock$switch_cmd(8, 7)
8294
my_dock
83-
#> FROM rocker/r-base
84-
#> MAINTAINER Colin FAY <contact@colinfay.me>
85-
#> RUN R -e 'install.packages("attempt", repo = "http://cran.irsn.fr/")'
86-
#> RUN mkdir /usr/scripts
87-
#> RUN cd /usr/scripts
88-
#> COPY plumberfile.R /usr/scripts/plumber.R
89-
#> EXPOSE 8000
90-
#> COPY torun.R /usr/scripts/torun.R
91-
#> CMD Rscript /usr/scripts/torun.R
9295
```
9396

9497
You can also remove a cmd with `remove_cmd`:
9598

9699
``` r
97100
my_dock$remove_cmd(8)
98101
my_dock
99-
#> FROM rocker/r-base
100-
#> MAINTAINER Colin FAY <contact@colinfay.me>
101-
#> RUN R -e 'install.packages("attempt", repo = "http://cran.irsn.fr/")'
102-
#> RUN mkdir /usr/scripts
103-
#> RUN cd /usr/scripts
104-
#> COPY plumberfile.R /usr/scripts/plumber.R
105-
#> EXPOSE 8000
106-
#> CMD Rscript /usr/scripts/torun.R
107102
```
108103

109104
This also works with a vector:
110105

111106
``` r
112107
my_dock$remove_cmd(5:7)
113108
my_dock
114-
#> FROM rocker/r-base
115-
#> MAINTAINER Colin FAY <contact@colinfay.me>
116-
#> RUN R -e 'install.packages("attempt", repo = "http://cran.irsn.fr/")'
117-
#> RUN mkdir /usr/scripts
118-
#> CMD Rscript /usr/scripts/torun.R
119109
```
120110

121111
`add_after` add a command after a given line.
122112

123113
``` r
124114
my_dock$add_after(
125-
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
115+
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
126116
after = 3
127117
)
128118
```
@@ -140,72 +130,20 @@ dependencies and the package.
140130

141131
``` r
142132
my_dock <- dock_from_desc("DESCRIPTION")
143-
#> ℹ Please wait while we compute system requirements...
144-
#> ✓ Done
145133
my_dock
146-
#> FROM rocker/r-ver:4.1.2
147-
#> RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libgit2-dev libicu-dev libssl-dev make pandoc pandoc-citeproc && rm -rf /var/lib/apt/lists/*
148-
#> RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
149-
#> RUN R -e 'install.packages("remotes")'
150-
#> RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.6.1")'
151-
#> RUN Rscript -e 'remotes::install_version("cli",upgrade="never", version = "3.1.1")'
152-
#> RUN Rscript -e 'remotes::install_version("R6",upgrade="never", version = "2.5.1")'
153-
#> RUN Rscript -e 'remotes::install_version("desc",upgrade="never", version = "1.4.0")'
154-
#> RUN Rscript -e 'remotes::install_version("fs",upgrade="never", version = "1.5.2")'
155-
#> RUN Rscript -e 'remotes::install_version("jsonlite",upgrade="never", version = "1.7.3")'
156-
#> RUN Rscript -e 'remotes::install_version("knitr",upgrade="never", version = "1.37")'
157-
#> RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.1.2")'
158-
#> RUN Rscript -e 'remotes::install_version("rmarkdown",upgrade="never", version = "2.11")'
159-
#> RUN Rscript -e 'remotes::install_version("usethis",upgrade="never", version = "2.1.5")'
160-
#> RUN Rscript -e 'remotes::install_version("renv",upgrade="never", version = "0.15.2")'
161-
#> RUN Rscript -e 'remotes::install_version("remotes",upgrade="never", version = "2.4.2")'
162-
#> RUN Rscript -e 'remotes::install_version("pkgbuild",upgrade="never", version = "1.3.1")'
163-
#> RUN Rscript -e 'remotes::install_version("pak",upgrade="never", version = "0.2.0")'
164-
#> RUN Rscript -e 'remotes::install_version("attempt",upgrade="never", version = "0.3.1")'
165-
#> RUN mkdir /build_zone
166-
#> ADD . /build_zone
167-
#> WORKDIR /build_zone
168-
#> RUN R -e 'remotes::install_local(upgrade="never")'
169-
#> RUN rm -rf /build_zone
170134

171135
my_dock$CMD(r(library(dockerfiler)))
172136

173137
my_dock$add_after(
174-
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
138+
cmd = "RUN R -e 'remotes::install_cran(\"rlang\")'",
175139
after = 3
176140
)
177141
my_dock
178-
#> FROM rocker/r-ver:4.1.2
179-
#> RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libgit2-dev libicu-dev libssl-dev make pandoc pandoc-citeproc && rm -rf /var/lib/apt/lists/*
180-
#> RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
181-
#> RUN R -e 'remotes::install_cran("rlang")'
182-
#> RUN R -e 'install.packages("remotes")'
183-
#> RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.6.1")'
184-
#> RUN Rscript -e 'remotes::install_version("cli",upgrade="never", version = "3.1.1")'
185-
#> RUN Rscript -e 'remotes::install_version("R6",upgrade="never", version = "2.5.1")'
186-
#> RUN Rscript -e 'remotes::install_version("desc",upgrade="never", version = "1.4.0")'
187-
#> RUN Rscript -e 'remotes::install_version("fs",upgrade="never", version = "1.5.2")'
188-
#> RUN Rscript -e 'remotes::install_version("jsonlite",upgrade="never", version = "1.7.3")'
189-
#> RUN Rscript -e 'remotes::install_version("knitr",upgrade="never", version = "1.37")'
190-
#> RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.1.2")'
191-
#> RUN Rscript -e 'remotes::install_version("rmarkdown",upgrade="never", version = "2.11")'
192-
#> RUN Rscript -e 'remotes::install_version("usethis",upgrade="never", version = "2.1.5")'
193-
#> RUN Rscript -e 'remotes::install_version("renv",upgrade="never", version = "0.15.2")'
194-
#> RUN Rscript -e 'remotes::install_version("remotes",upgrade="never", version = "2.4.2")'
195-
#> RUN Rscript -e 'remotes::install_version("pkgbuild",upgrade="never", version = "1.3.1")'
196-
#> RUN Rscript -e 'remotes::install_version("pak",upgrade="never", version = "0.2.0")'
197-
#> RUN Rscript -e 'remotes::install_version("attempt",upgrade="never", version = "0.3.1")'
198-
#> RUN mkdir /build_zone
199-
#> ADD . /build_zone
200-
#> WORKDIR /build_zone
201-
#> RUN R -e 'remotes::install_local(upgrade="never")'
202-
#> RUN rm -rf /build_zone
203-
#> CMD R -e 'library(dockerfiler)'
204142
```
205143

206144
## Create a Dockerfile from renv.lock
207145

208-
- Create renv.lock
146+
- Create renv.lock
209147

210148
``` r
211149
dir_build <- tempfile(pattern = "renv")
@@ -216,37 +154,31 @@ the_lockfile <- file.path(dir_build, "renv.lock")
216154
custom_packages <- c(
217155
# attachment::att_from_description(),
218156
"renv",
219-
"cli", "glue", "golem",
220-
"shiny", "stats", "utils",
157+
"cli",
158+
"glue",
159+
"golem",
160+
"shiny",
161+
"stats",
162+
"utils",
221163
"testthat",
222164
"knitr"
223165
)
224166
renv::snapshot(
225167
packages = custom_packages,
226168
lockfile = the_lockfile,
227-
prompt = FALSE)
169+
prompt = FALSE
170+
)
228171
```
229172

230-
- Build Dockerfile
173+
- Build Dockerfile
231174

232175
``` r
233-
my_dock <- dock_from_renv(lockfile = the_lockfile,
234-
distro = "focal",
235-
FROM = "rocker/verse"
236-
)
237-
#> ℹ Please wait while we compute system requirements...
238-
#> Fetching system dependencies for 81 package records.
239-
#> Warning: `lang()` is deprecated as of rlang 0.2.0.
240-
#> Please use `call2()` instead.
241-
#> This warning is displayed once per session.
242-
#> ✓ Done
176+
my_dock <- dock_from_renv(
177+
lockfile = the_lockfile,
178+
distro = "focal",
179+
FROM = "rocker/verse"
180+
)
243181
my_dock
244-
#> FROM rocker/verse:4.1
245-
#> RUN apt-get update -y && apt-get install -y make libcurl4-openssl-dev libssl-dev git libgit2-dev libicu-dev libxml2-dev zlib1g-dev pandoc && rm -rf /var/lib/apt/lists/*
246-
#> RUN echo "options(renv.config.pak.enabled = TRUE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
247-
#> RUN R -e 'install.packages(c("renv","remotes"))'
248-
#> COPY renv.lock renv.lock
249-
#> RUN R -e 'renv::restore()'
250182
```
251183

252184
## Contact

0 commit comments

Comments
 (0)