create.create()

Generate a Dockerfile and .dockerignore from an analysis directory.

Usage

Source

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 FROM instruction. Pass None to auto-detect: R projects use posit/r-base:{r_version}-noble; Python-only projects default to python:{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_r or detect_python must be True.

detect_python: bool = True

Whether to detect Python dependencies and prepare the Docker image accordingly. At least one of detect_r or detect_python must be True.

pigar_kwargs: dict = {}

Keyword arguments forwarded to pigar’s generate function (e.g. {"dry_run": True, "index_url": "..."}).

renv_kwargs: dict = {}

Keyword arguments forwarded to tugboat:::init_renv(), which passes them on to renv::dependencies().

optimize_pak: bool = True
When True, rewrites renv.lock to point at a Posit Package Manager binary mirror before running renv::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_r and detect_python are False.