This commit is contained in:
Alan Grainger
2026-10-07 09:56:31 +13:00
7 changed files with 18 additions and 7 deletions
+4 -1
View File
@@ -31,7 +31,7 @@ RUN rm -rf node_modules \
FROM node:lts-alpine AS runner FROM node:lts-alpine AS runner
RUN apk --no-cache add curl \ RUN apk --no-cache add curl tini \
&& mkdir /app && chown node:node /app && mkdir /app && chown node:node /app
# IPP stays at /app so the documented mounts (/app/config.json, # IPP stays at /app so the documented mounts (/app/config.json,
@@ -48,4 +48,7 @@ ARG PACKAGE_VERSION
ENV APP_VERSION=${PACKAGE_VERSION} ENV APP_VERSION=${PACKAGE_VERSION}
ENV NODE_ENV=production ENV NODE_ENV=production
# tini as PID 1 reaps orphaned healthcheck processes, which node does not (GitHub #66).
# -s keeps reaping, without a warning, when PID 1 is already an init (compose `init: true`).
ENTRYPOINT ["/sbin/tini", "-s", "--"]
CMD ["node", "dist/index.js" ] CMD ["node", "dist/index.js" ]
+4 -1
View File
@@ -31,7 +31,7 @@ RUN rm -rf node_modules \
FROM node:lts-alpine AS runner FROM node:lts-alpine AS runner
RUN apk --no-cache add curl \ RUN apk --no-cache add curl tini \
&& mkdir /app && chown node:node /app && mkdir /app && chown node:node /app
# At /app, as IPP, so a config.json mounts at the same path in both images # At /app, as IPP, so a config.json mounts at the same path in both images
@@ -47,4 +47,7 @@ ARG PACKAGE_VERSION
ENV APP_VERSION=${PACKAGE_VERSION} ENV APP_VERSION=${PACKAGE_VERSION}
ENV NODE_ENV=production ENV NODE_ENV=production
# tini as PID 1 reaps orphaned healthcheck processes, which node does not (GitHub #66).
# -s keeps reaping, without a warning, when PID 1 is already an init (compose `init: true`).
ENTRYPOINT ["/sbin/tini", "-s", "--"]
CMD ["node", "dist/index.js" ] CMD ["node", "dist/index.js" ]
+1 -1
View File
@@ -9,7 +9,7 @@
"build:client": "tsc -p tsconfig.client.json", "build:client": "tsc -p tsconfig.client.json",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:container": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -t immich-proxy-test .. && podman run --init -it -p=3000:3000 --env-file .env --restart=always immich-proxy-test", "test:container": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -t immich-proxy-test .. && podman run -it -p=3000:3000 --env-file .env --restart=always immich-proxy-test",
"start": "node dist/index.js" "start": "node dist/index.js"
}, },
"author": "Alan Grainger", "author": "Alan Grainger",
+1 -1
View File
@@ -9,6 +9,6 @@ services:
PUBLIC_BASE_URL: https://your-proxy-url.com PUBLIC_BASE_URL: https://your-proxy-url.com
IMMICH_URL: http://your-internal-immich-server:2283 IMMICH_URL: http://your-internal-immich-server:2283
healthcheck: healthcheck:
test: curl -s http://localhost:3000/share/healthcheck -o /dev/null || exit 1 test: curl -sf -m 4 http://localhost:3000/share/healthcheck -o /dev/null || exit 1
start_period: 10s start_period: 10s
timeout: 5s timeout: 5s
+1 -1
View File
@@ -49,7 +49,7 @@ services:
PUBLIC_BASE_URL: https://upload.example.com PUBLIC_BASE_URL: https://upload.example.com
GALLERY_URL: https://photos.example.com GALLERY_URL: https://photos.example.com
healthcheck: healthcheck:
test: curl -s http://localhost:3000/healthcheck -o /dev/null || exit 1 test: curl -sf -m 4 http://localhost:3000/healthcheck -o /dev/null || exit 1
start_period: 10s start_period: 10s
timeout: 5s timeout: 5s
``` ```
+6 -1
View File
@@ -72,9 +72,14 @@ export function getKeyTypeFromShare (shareType: string) {
/** /**
* Reachability ping for the `/share/healthcheck` route. * Reachability ping for the `/share/healthcheck` route.
*
* Capped at 3 s so a slow Immich fails the healthcheck instead of hanging it.
* The compose healthcheck gives curl 4 s inside Docker's 5 s timeout; a check
* that overruns gets killed and leaves a zombie curl behind (GitHub #66).
*/ */
export async function accessible () { export async function accessible () {
return !!(await request('/server/ping')) // The catch covers a timeout during the body read, which request() does not
return !!(await request('/server/ping', { signal: AbortSignal.timeout(3000) }).catch(() => null))
} }
// Minimum Immich server version IPP is compatible with // Minimum Immich server version IPP is compatible with
+1 -1
View File
@@ -8,7 +8,7 @@
"build": "tsc -b && tsc -p tsconfig.client.json", "build": "tsc -b && tsc -p tsconfig.client.json",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:container": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -f ../Dockerfile.upload -t immich-proxy-upload-test .. && podman run --init -it -p=3001:3000 --env-file .env -e IPP_PORT=3000 --restart=always immich-proxy-upload-test", "test:container": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -f ../Dockerfile.upload -t immich-proxy-upload-test .. && podman run -it -p=3001:3000 --env-file .env -e IPP_PORT=3000 --restart=always immich-proxy-upload-test",
"start": "node dist/index.js" "start": "node dist/index.js"
}, },
"author": "Alan Grainger", "author": "Alan Grainger",