Skip to content

immich-layer

Recipe card from the charly-immich plugin (Images — the deployable catalog).

immich – Self-hosted photo management server (server + web + ML in one candy)

Section titled “immich – Self-hosted photo management server (server + web + ML in one candy)”
Property Value
Dependencies supervisord, nodejs, postgresql, redis, ffmpeg
Ports 2283 (server + web UI), 3003 (machine learning)
Volumes library -> ~/.immich/library, import -> ~/.immich/import, external -> ~/.immich/external, models -> ~/.immich/models
Service immich-db-init (oneshot, priority 15), immich-server (priority 30), immich-ml (priority 40)
Route immich.localhost:2283
Variable Value
IMMICH_VERSION (var) v3.4.2
IMMICH_SOURCE_REF v3.4.2 (what start.sh-style wrappers log)
IMMICH_HOST / IMMICH_PORT 0.0.0.0 / 2283
IMMICH_MEDIA_LOCATION ~/.immich/library
IMMICH_MACHINE_LEARNING_ENABLED true
IMMICH_MACHINE_LEARNING_URL http://127.0.0.1:3003
MACHINE_LEARNING_HOST / _PORT / _WORKERS / _WORKER_TIMEOUT 0.0.0.0 / 3003 / 1 / 120
HF_HOME ~/.immich/models — the model cache folder. The ML venv ships huggingface_hub, which honours HF_HOME; the older TRANSFORMERS_CACHE name is read by nothing in v3.4.2 (measured in this image: 9 HF_HOME references in the venv, 0 for TRANSFORMERS_CACHE), and must not be set
DB_HOSTNAME / DB_DATABASE_NAME ~/.postgresql (socket dir) / immich
DB_USERNAME / DB_PASSWORD immich / immich
REDIS_HOSTNAME / REDIS_PORT 127.0.0.1 / 6379
NODE_ENV production

IMMICH_MACHINE_LEARNING_URL is not optional in this image: Immich’s own default (http://immich-machine-learning:3003) names the upstream docker-compose service and does not resolve here, where the ML backend is a supervised service in the SAME image.

The candy is multi-distro — image libraries are declared per distro:

  • RPM: vips, vips-devel, perl-Image-ExifTool, libheif, LibRaw, gcc-c++, make, unzip, curl, python3
  • PAC: libvips (no separate -devel split — headers ship in the same package), libheif, libraw, perl-image-exiftool, gcc (includes g++), make, unzip, curl, python

Note: FFmpeg is provided via the ffmpeg dependency candy rather than installed directly.

Every version below is what Immich v3.4.2 itself pins (root package.json packageManager, .nvmrc, mise.toml): pnpm 12.15.0, extism-js v1.7.0 (js-pdk), binaryen version_124, uv 0.8.15, and the ML venv’s Python 3.13.

  1. Toolchain — pnpm 12.15.0 (a tarball in the 12.x line, not the 10.x single binary) into /opt/immich/pnpm; uv from its release tarball. The image’s own pnpm from layer-nodejs is deliberately NOT replaced. The pin is the candy’s IMMICH_PNPM_VERSION var, NAMESPACED because var: values are exported as image ENV: an un-namespaced pnpm pin here is global and shadows layer-nodejs’s own same-named pin, whose measurement check reads it at probe time (measured: distro-cachyos check-cachyos-immich-pod failed one check of 123 with “pnpm 12.15.0 is UNMEASURED”).

  2. Workspace packages — @immich/sdk → @immich/plugin-sdk → server; the server has a workspace:* dependency on @immich/plugin-sdk, so the order matters.

  3. Core plugin (WASM) — packages/plugin-core (moved from plugins/ in v3), compiled with extism-js into /build/plugins/immich-plugin-core/{dist,manifest.json}.

  4. Server — pnpm --filter immich build, then pnpm --filter immich --prod --no-optional deploy /opt/immich/server, then the mandatory sharp rebuild against the system libvips (SHARP_FORCE_GLOBAL_LIBVIPS=true … --dir /opt/immich/server/node_modules/sharp exec npm run build).

  5. Web UI — pnpm --filter immich-web build → /build/www; the build needs the i18n/ tree present (web/package.json maps #i18n/* to ../i18n/*).

  6. Geodata — admin1CodesASCII.txt, admin2Codes.txt, countryInfo.txt (NEW in v3 and required), cities500.zip → cities500.txt, and the Natural Earth country outline pinned to tag v5.1.2. geodata-date.txt is read unguarded at boot. /build/build-lock.json ships as a valid empty {"sources":[],"packages":[]} — the server only warns when the file is absent.

  7. Machine learning — uv venv --python 3.13 then uv sync --frozen --no-dev --no-editable --active --link-mode copy --extra cuda --group cuda-libs in machine-learning/, installed into /opt/immich/machine-learning/.venv. cuda is an OPTIONAL-DEPENDENCY (--extra); cuda-libs is a DEPENDENCY GROUP (--group) — passing it as --extra fails with “Extra cuda-libs is not defined in the project’s optional-dependencies table”. Together they make the venv self-contained with CUDA 12 runtime wheels, which is what an Arch/CachyOS base needs (its system CUDA is 13.x). ONNX Runtime’s CUDAExecutionProvider is a build-scope check, so a regression in the GPU stack turns red.

    The managed CPython must be installed outside root’s home (UV_PYTHON_INSTALL_DIR), the venv is run through /opt/immich/ml-run.sh (which activates it and puts the wheel lib dirs on LD_LIBRARY_PATH), and the immich-ml service overrides IMMICH_HOST/IMMICH_PORT because immich_ml reads those non-prefixed names. All three are load-bearing, not decoration: without them the ML backend is unreadable to the image’s uid-1000 user, cannot find gunicorn, or binds the server’s own port.

  8. PostgreSQL extensions — /docker-entrypoint-initdb.d/01-immich-extensions.sql seeds vector, vchord CASCADE, cube and earthdistance CASCADE on first initdb; /usr/local/bin/immich-db-migrate.sh re-ensures them idempotently on every start via the immich-db-init service.

  9. Server startup wrapper — /usr/local/bin/immich-server-start.sh waits for pg_isready, then execs node /opt/immich/server/dist/main.js. The .js extension is required: server/package.json is "type": "module".

All pnpm steps export npm_config_cache / npm_config_store_dir under /tmp so a root build leaves no root-owned files in the container user’s cache.

Name Env Vars
db-password DB_PASSWORD, POSTGRES_PASSWORD
charly.yml
immich:
candy:
- '@github.com/opencharly/pod-immich'
  • distro-cachyos/box/immich-cdi (CachyOS CDI pod base) — the single Immich image; the ML backend it needs is the supervised immich-ml service this candy declares.

Use when the user asks about:

  • Immich photo management setup
  • Photo library configuration
  • Immich database or Redis connectivity
  • Port 2283 or immich.localhost route
  • Machine learning: face recognition, smart search, OCR (port 3003)
  • Media processing (vips, ffmpeg, ExifTool)
  • /charly-image:layer — candy authoring reference (charly.yml schema, plan verbs, service declarations)
  • /charly-check:check — declarative testing (check: block, charly check box, charly check live)