knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
options(repos = c(CRAN = "https://cran.rstudio.com/"))
dockr
is a small toolkit to build a lightweight Docker r-base container
image for your R package, in which the package itself is available. The Docker
image seeks to mirror your R session as close as possible with respect to R
specific dependencies. Both dependencies on CRAN R packages as well as local
non-CRAN R packages will be included in the Docker container image.
Install the development version of dockr
with:
remotes::install_github("smaakage85/dockr")
Or install the version released on CRAN:
install.packages("dockr")
In order to create the files, that will constitute the Docker image, simply
invoke the prepare_docker_image()
function and point to the folder with your
package.
The workflow of prepare_docker_image()
is summarized below:
Now, I will let dockr
do its magic and create the files for a Docker r-base
container image, in which dockr
is installed together with all of the R
package dependencies, dockr
needs to run.
Beware that the files for the Docker image are created as side-effects of the function call (under the 'dir_image' directory). Also the package is installed as a side effect (in the 'dir_install' directory).
library(dockr) image_dockr <- prepare_docker_image(".", dir_image = tempdir(), dir_install = "temp")
Great, all necessary files for the Docker image have been created, and you can build the Docker image right away by following the instructions. It is as easy as that! Yeah!
dockr
does not deal with non-R dependencies at this point.
In case that, for instance, your package has any Linux specific dependencies,
you will have to install them yourself in the Docker container image. For that
purpose you can edit the Dockerfile further with the 'write_lines_to_file'
function.
I hope, that you will find dockr
useful.
Please direct any questions and feedbacks to me!
If you want to contribute, open a PR.
If you encounter a bug or want to suggest an enhancement, please open an issue.
Best, smaakagen
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.