create | R Documentation |
This function will crawl all files in the current project/directory and
(attempt to) detect all R packages and store these in a lockfile. From this
lockfile, it will create a corresponding Dockerfile. It will also copy
the full contents of the current directory/project into the Docker image.
The directory in the Docker container containing the current directory
contents will be /current-directory-name. For example if your analysis
directory is named incredible_analysis
, the corresponding location in
the generated Docker image will be /incredible_analysis
.
create(
project = here::here(),
as = file.path(project, "Dockerfile"),
FROM = NULL,
...,
exclude = NULL
)
project |
The project directory. If no project directory is provided, by default, the here package will be used to determine the active project. If no project is currently active, then here defaults to the working directory where initially called. |
as |
The file path to write to. The default value is
|
FROM |
Docker image to start FROM. Default is FROM r-base:R.version. |
... |
Additional arguments which are passed directly to renv::snapshot. Please see the documentation for that function for all relevant details. |
exclude |
A vector of strings specifying all paths (files or directories) that should NOT be included in the Docker image. By default, all files in the directory will be included. NOTE: the file and directory paths should be relative to the project directory. They do NOT need to be absolute paths. |
The Dockerfile contained as a string vector. Each vector element corresponds to a line in the Dockerfile.
here::here; this will be used by default to determine the current project directory.
renv::snapshot which this function relies on to find all R dependencies and create a corresponding lockfile.
## Not run:
# Create a Dockerfile based on the rocker/rstudio image.
# Write the Dockerfile locally to here::here("Dockerfile").
# Copy all files except the /data and /examples directories.
dock <- create(
project = here::here(),
FROM = "rocker/rstudio",
exclude = c("/data", "/examples")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.