Title: | Help Develop a R Project Inside a Docker Container |
---|---|
Description: | Help develop a R project inside a Docker container. |
Authors: | Sébastien Rochette [aut, cre] , ThinkR [cph] |
Maintainer: | Sébastien Rochette <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1.9000 |
Built: | 2024-11-23 02:45:52 UTC |
Source: | https://github.com/ThinkR-open/devindocker |
Launch and stop Docker
Stop running Docker container
launch_proj_docker( path = ".", container = "thinkr/rstudio3_6_1_geo", network_name = "r-db", port = 8787, renv_inst = FALSE, renv_cache = FALSE, renv_out = FALSE, renv_out_dir, update_docker = TRUE, is_root = FALSE, volumes, open_url = TRUE, url = "http://127.0.0.1", password = NULL ) stop_proj_docker(path, sleep = 10, network_name = "r-db", stop_network = TRUE)
launch_proj_docker( path = ".", container = "thinkr/rstudio3_6_1_geo", network_name = "r-db", port = 8787, renv_inst = FALSE, renv_cache = FALSE, renv_out = FALSE, renv_out_dir, update_docker = TRUE, is_root = FALSE, volumes, open_url = TRUE, url = "http://127.0.0.1", password = NULL ) stop_proj_docker(path, sleep = 10, network_name = "r-db", stop_network = TRUE)
path |
Path to project or any directory to launch. |
container |
Docker container to download from docker hub. |
network_name |
Character. Give the name of the network in which the
container will be included using |
port |
Local port to which to launch Rstudio Server |
renv_inst |
Logical. Whether to add a R script with renv instructions in the project. |
renv_cache |
Path to renv cache on your computer. Set to FALSE to not use renv. |
renv_out |
Whether to set renv libraries out of the project. |
renv_out_dir |
Where to store project libraries. Default to a ".renv" folder in the parent directory of "path" |
update_docker |
Logical. Whether to update Docker container with DockerHub. |
is_root |
logical. Whether the Docker user has root permissions (add to sudoers).
Can be useful if you want to simulate your CI behaviour in the Terminal using " |
volumes |
data.frame with two columns named |
open_url |
Logical. Whether to open container URL in browser on http://127.0.0.1:port |
url |
Localhost url. Default to "http://127.0.0.1". "localhost" can be a good alternative. |
password |
String. Default to NULL. If not NULL, |
sleep |
Numeric. Number of seconds to wait for user to correctly stop Rstudio Server |
stop_network |
Logical. Whether to stop Docker network. |
renv_out : It is recommended to set renv library out of the project to avoid copy of entire library
during package checks. See vignette("packages", package = "renv")
.
## Not run: tempdir <- tempdir() path <- file.path(tempdir, "myproject") usethis::create_package(path, open = FALSE) # Which Rstudio container ? ---- container <- c("thinkr/rstudio3_5_2", "rocker/geospatial:4.0.1")[2] # Which port ? ---- # _Useful if multiple Rstudio Server to launch port <- 8788 # _Start Docker project launch_proj_docker(path = path, container = container, port = port) # _Stop Docker properly stop_proj_docker(path = path, sleep = 5) # With renv cache shared with host dir.create(file.path(tempdir, "cache")) tempcache <- file.path(tempdir, "cache") # _Start Docker project launch_proj_docker(path = path, container = container, port = port, renv_cache = tempcache) # _Stop Docker properly stop_proj_docker(path = path, sleep = 5) # Mount with additional volumes ## End(Not run)
## Not run: tempdir <- tempdir() path <- file.path(tempdir, "myproject") usethis::create_package(path, open = FALSE) # Which Rstudio container ? ---- container <- c("thinkr/rstudio3_5_2", "rocker/geospatial:4.0.1")[2] # Which port ? ---- # _Useful if multiple Rstudio Server to launch port <- 8788 # _Start Docker project launch_proj_docker(path = path, container = container, port = port) # _Stop Docker properly stop_proj_docker(path = path, sleep = 5) # With renv cache shared with host dir.create(file.path(tempdir, "cache")) tempcache <- file.path(tempdir, "cache") # _Start Docker project launch_proj_docker(path = path, container = container, port = port, renv_cache = tempcache) # _Stop Docker properly stop_proj_docker(path = path, sleep = 5) # Mount with additional volumes ## End(Not run)
Update renv instructions with last version
update_renv_help(path = "", overwrite = TRUE)
update_renv_help(path = "", overwrite = TRUE)
path |
Path where to save the renv_instructions.Rmd file |
overwrite |
Whether to overwrite existing file |