From 0127be2366f52bee11b22150f4d9e294b437f1eb Mon Sep 17 00:00:00 2001 From: User Joe <5625795+jtrotsky@users.noreply.github.com> Date: Sat, 20 Jun 2026 00:18:26 +1200 Subject: [PATCH] fix: create /app before writing version, fix sed and perms The build failed at the npm RUN step: it redirected `npm list ... > /app/version` but nothing created /app, so the shell errored with "cannot create /app/version: No such file or directory". - mkdir -p /app before writing the version file - sed -n 's/.*@//p' so only the @immich/cli line is emitted (npm list prints the prefix path as its first line, which otherwise leaked into the version string) - chmod /app world-readable so the unprivileged bsd user can read /app/version at runtime Co-Authored-By: Claude Opus 4.8 --- Containerfile | 5 +++-- Containerfile.j2 | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Containerfile b/Containerfile index 50e617a..22ecb6e 100644 --- a/Containerfile +++ b/Containerfile @@ -37,7 +37,8 @@ LABEL org.opencontainers.image.title="immich-cli" \ # prebuilt py311 wheels to dodge cargo). Pin the exact version for reproducibility. RUN pkg update && pkg install -y ca_root_nss node22 npm-node22 \ && npm install -g @immich/cli@${IMMICH_CLI_VERSION} \ - && npm list -g @immich/cli --depth=0 | sed 's/.*@//' > /app/version \ + && mkdir -p /app \ + && npm list -g @immich/cli --depth=0 | sed -n 's/.*@//p' > /app/version \ && npm cache clean --force \ && pkg clean -ay && rm -rf /var/cache/pkg/* /root/.npm @@ -49,7 +50,7 @@ RUN pkg update && pkg install -y ca_root_nss node22 npm-node22 \ # Unprivileged runtime. /import is the conventional mount point for the media to # upload (mounted read-only at run time). Server URL + key are supplied at run # time via env (IMMICH_INSTANCE_URL, IMMICH_API_KEY) or `immich login`. -RUN chmod -R a+rX /usr/local/lib/node_modules \ +RUN chmod -R a+rX /usr/local/lib/node_modules /app \ && mkdir -p /import && chown -R bsd:bsd /import USER bsd WORKDIR /import diff --git a/Containerfile.j2 b/Containerfile.j2 index d50bc96..79c3f37 100644 --- a/Containerfile.j2 +++ b/Containerfile.j2 @@ -31,7 +31,8 @@ LABEL org.opencontainers.image.title="immich-cli" \ # prebuilt py311 wheels to dodge cargo). Pin the exact version for reproducibility. RUN pkg update && pkg install -y ca_root_nss node22 npm-node22 \ && npm install -g @immich/cli@${IMMICH_CLI_VERSION} \ - && npm list -g @immich/cli --depth=0 | sed 's/.*@//' > /app/version \ + && mkdir -p /app \ + && npm list -g @immich/cli --depth=0 | sed -n 's/.*@//p' > /app/version \ && npm cache clean --force \ && pkg clean -ay && rm -rf /var/cache/pkg/* /root/.npm @@ -43,7 +44,7 @@ RUN pkg update && pkg install -y ca_root_nss node22 npm-node22 \ # Unprivileged runtime. /import is the conventional mount point for the media to # upload (mounted read-only at run time). Server URL + key are supplied at run # time via env (IMMICH_INSTANCE_URL, IMMICH_API_KEY) or `immich login`. -RUN chmod -R a+rX /usr/local/lib/node_modules \ +RUN chmod -R a+rX /usr/local/lib/node_modules /app \ && mkdir -p /import && chown -R bsd:bsd /import USER bsd WORKDIR /import