neurodocker.reproenv.renderers module#

Container specification renderers.

class neurodocker.reproenv.renderers.DockerRenderer(pkg_manager: Literal['apt', 'yum'], users: set[str] | None = None)[source]#

Bases: _Renderer

add(source: str | Path | PathLike, destination: str | Path | PathLike) DockerRenderer[source]#

Add a Dockerfile ADD instruction.

arg(key: str, value: str = None) DockerRenderer[source]#

Add a Dockerfile ARG instruction.

copy(source: str | Path | PathLike | list[Union[str, pathlib.Path, os.PathLike]], destination: str | Path | PathLike, from_: str = None, chown: str = None) DockerRenderer[source]#

Add a Dockerfile COPY instruction.

entrypoint(args: list[str]) DockerRenderer[source]#
env(**kwds: str) DockerRenderer[source]#

Add a Dockerfile ENV instruction.

from_(base_image: str, as_: str = None) DockerRenderer[source]#

Add a Dockerfile FROM instruction.

install(pkgs: list[str], opts=None) DockerRenderer[source]#

Install system packages.

label(**kwds: str) DockerRenderer[source]#

Add a Dockerfile LABEL instruction.

render() str[source]#

Return the rendered Dockerfile.

run(command: str) DockerRenderer[source]#

Add a Dockerfile RUN instruction.

user(user: str) DockerRenderer[source]#

Add a Dockerfile USER instruction. If the user is not in self.users, then a RUN instruction that creates the user will also be added.

workdir(path: str | Path | PathLike) DockerRenderer[source]#

Add a Dockerfile WORKDIR instruction.

class neurodocker.reproenv.renderers.SingularityRenderer(pkg_manager: Literal['apt', 'yum'], users: set[str] | None = None)[source]#

Bases: _Renderer

arg(key: str, value: str = None) SingularityRenderer[source]#
copy(source: str | Path | PathLike | list[Union[str, pathlib.Path, os.PathLike]], destination: str | Path | PathLike) SingularityRenderer[source]#
entrypoint(args: list[str]) SingularityRenderer[source]#
env(**kwds: str) SingularityRenderer[source]#
from_(base_image: str) SingularityRenderer[source]#
install(pkgs: list[str], opts=None) SingularityRenderer[source]#

Install system packages.

label(**kwds: str) SingularityRenderer[source]#
render() str[source]#

Return a rendered string of the container specification.

This method should take care of combining all of the instructions in a way that makes sense for the container type. For a Dockerfile, it might stack the sequence of instructions into a string. For a Singularity recipe, it might organize the instructions into their respective locations, like %post, %files.

This method is used by Renderer.__str__ to create the full container spec.

run(command: str) SingularityRenderer[source]#
user(user: str) SingularityRenderer[source]#
workdir(path: str | Path | PathLike) SingularityRenderer[source]#