create.create()
Generate a Dockerfile and .dockerignore from an analysis directory.
Usage
create.create(
project=Path("."),
FROM="rocker/r-ver:latest",
exclude=None,
verbose=False,
detect_r=True,
detect_python=True,
pigar_kwargs={},
renv_kwargs={},
optimize_pak=True
)Scans project for Python and/or R dependencies, writes a requirements.txt (Python) and/or renv.lock (R), and generates a Dockerfile that copies the project into the image and installs all detected dependencies. Python dependencies are installed with uv; R dependencies are installed with pak and renv.
Parameters
project: str or Path = current working directory-
Path to the analysis directory to generate a Dockerfile from.
FROM: str or None = "rocker/r-ver:latest"-
Base Docker image for the generated
FROMinstruction. PassNoneto auto-detect: R projects useposit/r-base:{r_version}-noble; Python-only projects default topython:{py_version}-slim. exclude: list of str, str, or None = None-
File(s) or sub-directories to exclude from the Docker image via the generated
.dockerignore. verbose: bool = False-
Whether to print the generated Dockerfile contents.
detect_r: bool = True-
Whether to detect R dependencies and prepare the Docker image accordingly. At least one of
detect_rordetect_pythonmust be True. detect_python: bool = True-
Whether to detect Python dependencies and prepare the Docker image accordingly. At least one of
detect_rordetect_pythonmust be True. pigar_kwargs: dict = {}-
Keyword arguments forwarded to pigar’s
generatefunction (e.g.{"dry_run": True, "index_url": "..."}). renv_kwargs: dict = {}-
Keyword arguments forwarded to
tugboat:::init_renv(), which passes them on torenv::dependencies(). optimize_pak: bool = True-
When True, rewrites
renv.lockto point at a Posit Package Manager binary mirror before runningrenv::restore(), which substantially speeds up R package installation. Set to False if you encounter R package installation errors as a first debugging step.
Returns
None
Raises
ValueError-
If both
detect_randdetect_pythonare False.