diff --git a/Dockerfile b/Dockerfile index 07061d5..050564d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,10 +81,11 @@ RUN mkosi --version # Install project dependencies into a persistent venv so that # `uv run` inside the container reuses it instead of recreating one. COPY pyproject.toml /opt/captain/pyproject.toml +COPY uv.lock /opt/captain/uv.lock COPY captain /opt/captain/captain COPY build.py /opt/captain/build.py RUN uv venv /opt/captain-venv && \ - VIRTUAL_ENV=/opt/captain-venv uv pip install --project /opt/captain /opt/captain + UV_PROJECT_ENVIRONMENT=/opt/captain-venv uv sync --frozen --project /opt/captain # Point uv at the pre-built venv for all future runs. ENV VIRTUAL_ENV=/opt/captain-venv diff --git a/captain/cli/_stages.py b/captain/cli/_stages.py index d15284e..0f5c3ac 100644 --- a/captain/cli/_stages.py +++ b/captain/cli/_stages.py @@ -103,10 +103,10 @@ def _build_mkosi_stage(cfg: Config, extra_args: list[str]) -> None: return # --- idempotency -------------------------------------------------- - initramfs_image = cfg.initramfs_output / "image.cpio.zst" + existing = sorted(cfg.initramfs_output.glob("*.cpio*")) force = "--force" in cfg.mkosi_args - if initramfs_image.is_file() and not force: - log.info("Initramfs already built: %s (use --force to rebuild)", initramfs_image) + if existing and not force: + log.info("Initramfs already built: %s (use --force to rebuild)", existing[0]) return mkosi_args = list(cfg.mkosi_args) + list(extra_args)