fix: clean docker data dir before init

This commit is contained in:
Nick Sweeting 2026-06-01 09:54:13 -07:00
parent c9bba6961d
commit ddb861b1cf
No known key found for this signature in database
3 changed files with 8 additions and 0 deletions

View File

@ -373,6 +373,7 @@ RUN --mount=type=cache,target=/root/.cache/uv,sharing=locked,id=uv-$TARGETARCH$T
# Initialize an empty image collection without rerunning dependency installs.
WORKDIR "$DATA_DIR"
RUN echo "[+] Initializing image collection..." \
&& find "$DATA_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} + \
&& PUID=0 PGID=0 archivebox init \
&& find "$DATA_DIR" -type d -name __pycache__ -prune -exec rm -rf {} + \
&& find "$DATA_DIR" -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete \

View File

@ -184,6 +184,7 @@ RUN echo "[*] Setting up $ARCHIVEBOX_USER user uid=${DEFAULT_PUID}..." \
WORKDIR "$DATA_DIR"
RUN echo "[+] Initializing image collection..." \
&& find "$DATA_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} + \
&& PUID=0 PGID=0 archivebox init \
&& find "$DATA_DIR" -type d -name __pycache__ -prune -exec rm -rf {} + \
&& find "$DATA_DIR" -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete \

View File

@ -91,3 +91,9 @@ def test_dockerfile_build_installs_disable_release_age_gate() -> None:
def test_dockerfiles_do_not_queue_optional_binaries_during_validation() -> None:
for dockerfile_name in ("Dockerfile", "Dockerfile.multistage"):
assert _bare_archivebox_install_commands(REPO_ROOT / dockerfile_name) == []
def test_dockerfiles_clean_build_data_dir_before_init() -> None:
for dockerfile_name in ("Dockerfile", "Dockerfile.multistage"):
text = (REPO_ROOT / dockerfile_name).read_text()
assert 'find "$DATA_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} +' in text