diff --git a/src/pythainer/builders/cmds.py b/src/pythainer/builders/cmds.py index b576a95..127f18e 100644 --- a/src/pythainer/builders/cmds.py +++ b/src/pythainer/builders/cmds.py @@ -195,7 +195,7 @@ def _add_pkg_apt(packages: list[str]) -> str: Returns: str: A Dockerfile RUN command to update, install, and clean up apt packages. """ - fmt_packages = "".join([f" {p} \\\n" for p in sorted(packages)]) + fmt_packages = "".join([f" {p} \\\n" for p in sorted(set(packages))]) cmd = ( f"apt-get update && apt-get install -y --no-install-recommends \\\n{fmt_packages}" f" && rm -rf /var/lib/apt/lists/*" diff --git a/src/pythainer/runners/__init__.py b/src/pythainer/runners/__init__.py index a6593cd..017251d 100644 --- a/src/pythainer/runners/__init__.py +++ b/src/pythainer/runners/__init__.py @@ -153,12 +153,12 @@ def __init__( self._tty = tty self._interactive = interactive - self._cached_command = None + self._cached_command: list[str] | None = None def __or__(self, other: DockerRunner) -> "ConcreteDockerRunner": if isinstance(other, ConcreteDockerRunner): return NotImplemented - abstract_runner = super().__or__(other=other) + abstract_runner = super().__or__(other) return abstract_runner.concretize( image=self._image, name=self._name, @@ -253,8 +253,8 @@ def run( command = command[:-1] if commands: commands_serial = " && ".join(commands) - commands_serial = ["bash", "-c", commands_serial] - command.extend(commands_serial) + commands_serial_lst = ["bash", "-c", commands_serial] + command.extend(commands_serial_lst) shell_out( command=command, output_is_log=True,