container: Pull fresh base image on update and drop unused constant

This commit is contained in:
Jeena 2026-05-28 21:56:38 +00:00
parent 7507534cf0
commit 7984b9129a

View file

@ -27,7 +27,6 @@ class AgentContainer:
IMAGE = "agent-container:latest"
CONTAINER_PREFIX = "ac-"
DATA_DIR_NAME = "agent-container"
PROJECT_ID_LEN = 12
START_TIMEOUT = 3.0
def __init__(self):
@ -215,7 +214,7 @@ class AgentContainer:
== 0
)
def build_image(self, no_cache: bool = False) -> None:
def build_image(self, no_cache: bool = False, pull: bool = False) -> None:
logger.info(
f"Building image '{self.IMAGE}' with user {self.host_username} ({self.host_uid}:{self.host_gid})"
)
@ -233,6 +232,8 @@ class AgentContainer:
]
if no_cache:
cmd.append("--no-cache")
if pull:
cmd.append("--pull")
cmd.append(str(self.docker_context_dir))
self._run_cmd(cmd)
@ -297,7 +298,7 @@ class AgentContainer:
stderr=subprocess.DEVNULL,
)
logger.info("Rebuilding image with latest versions...")
self.build_image(no_cache=True)
self.build_image(no_cache=True, pull=True)
logger.info("Update complete. Containers will be recreated on next run.")
def purge(self) -> None: