专属域名
文档搜索
提交工单
轩辕助手
Run助手
返回顶部
快速返回页面顶部
收起
收起工具栏

majorfi/immich-stack Docker 镜像 - 轩辕镜像

immich-stack
majorfi/immich-stack
Automatically groups similar photos into stacks within the Immich photo management system.
0 次下载activemajorfi
🚀专业版镜像服务,面向生产环境设计
镜像简介版本下载
🚀专业版镜像服务,面向生产环境设计

Immich Stack

Automatically groups similar photos into stacks within the Immich photo management system.

Quick Start

bash
# Create a .env file
cat > .env << EOL
API_KEY=your_immich_api_key
API_URL=[***]
RUN_MODE=cron
CRON_INTERVAL=60
EOL

# Run with Docker (using Docker Hub)
docker run -d --name immich-stack --env-file .env -v ./logs:/app/logs majorfi/immich-stack:latest

# Or using GitHub Container Registry
docker run -d  --name immich-stack --env-file .env -v ./logs:/app/logs ghcr.io/majorfi/immich-stack:latest

Environment Variables

VariableDescriptionDefault
API_KEYYour Immich API key(required)
API_URLImmich API URL[***]
RUN_MODERun mode (once or cron)once
CRON_INTERVALInterval in seconds for cron mode86400
DRY_RUNDon't apply changesfalse
RESET_STACKSDelete all existing stacksfalse
REPLACE_STACKSReplace stacks for new groupsfalse
PARENT_FILENAME_PROMOTEParent filename promoteedit
PARENT_EXT_PROMOTEParent extension promote.jpg,.dng
WITH_ARCHIVEDInclude archived assetsfalse
WITH_DELETEDInclude deleted assetsfalse

Docker Compose

yaml
version: "3.8"

services:
  immich-stack:
    container_name: immich_stack
    # Use Docker Hub image (recommended for Portainer)
    image: majorfi/immich-stack:latest
    # Or use GitHub Container Registry
    # image: ghcr.io/majorfi/immich-stack:latest
    environment:
      - API_KEY=${API_KEY}
      - API_URL=${API_URL:-[***]}
      - DRY_RUN=${DRY_RUN:-false}
      - RESET_STACKS=${RESET_STACKS:-false}
      - REPLACE_STACKS=${REPLACE_STACKS:-false}
      - PARENT_FILENAME_PROMOTE=${PARENT_FILENAME_PROMOTE:-edit}
      - PARENT_EXT_PROMOTE=${PARENT_EXT_PROMOTE:-.jpg,.dng}
      - WITH_ARCHIVED=${WITH_ARCHIVED:-false}
      - WITH_DELETED=${WITH_DELETED:-false}
      - RUN_MODE=${RUN_MODE:-once}
      - CRON_INTERVAL=${CRON_INTERVAL:-86400}
    volumes:
      - ./logs:/app/logs
    restart: on-failure

Development

bash
# Build locally
docker build -t immich-stack .

# Run locally
docker run -d \
  --name immich-stack \
  --env-file .env \
  -v ./logs:/app/logs \
  immich-stack

Immich Stack

Immich Stack is a Go CLI tool and library for automatically grouping ("stacking") similar photos in the Immich photo management system. It provides configurable, robust, and extensible logic for grouping, sorting, and managing photo stacks via the Immich API. This project is heavily inspired by immich-auto-stack.


Features

  • Automatic Stacking: Groups similar photos into stacks based on filename, date, and custom criteria.
  • Configurable Grouping: Supports custom grouping logic via environment variables and command-line flags.
  • Parent/Child Promotion: Fine-grained control over which files are promoted as stack parents (by substring or extension).
  • CLI Tool: Command-line interface for batch processing and automation.
  • Safe Operations: Supports dry-run mode, stack replacement, and reset with user confirmation.
  • Comprehensive Logging: Colorful, structured logs for all operations.
  • Tested and Modular: Table-driven tests, modular helpers, and clear separation of concerns.

Installation

Prerequisites
  • Go (version 1.21 or later)
  • Git
From Source
  1. Clone the repository:

    sh
    git clone [***]
    cd immich-stack
    
  2. Build the binary:

    sh
    go build -o immich-stack ./cmd/main.go
    
  3. Move the binary to your PATH (optional):

    sh
    sudo mv immich-stack /usr/local/bin/
    
Using Pre-built Binaries
  1. Download the latest release from the Releases page
  2. Extract the archive
  3. Move the binary to your PATH (optional)

Docker Installation

  1. Clone the repository:

    sh
    git clone [***]
    cd immich-stack
    
  2. Create a .env file from the example:

    sh
    cp .env.example .env
    
  3. Edit the .env file with your Immich credentials and preferences:

    sh
    # Required
    API_KEY=your_immich_api_key
    API_URL=[***]
    
    # Optional - Default values shown
    DRY_RUN=false
    RESET_STACKS=false
    REPLACE_STACKS=false
    PARENT_FILENAME_PROMOTE=edit
    PARENT_EXT_PROMOTE=.jpg,.dng
    WITH_ARCHIVED=false
    WITH_DELETED=false
    
    # Run mode settings
    RUN_MODE=once  # Options: once, cron
    CRON_INTERVAL=86400  # in seconds, only used if RUN_MODE=cron
    
  4. Start the service:

    sh
    docker compose up -d
    
  5. To run in cron mode, set RUN_MODE=cron in your .env file and restart:

    sh
    docker compose down
    docker compose up -d
    
  6. To view logs:

    sh
    docker compose logs -f
    
  7. To stop the service:

    sh
    docker compose down
    

Integration with Immich Docker Compose

To integrate with an existing Immich installation:

  1. Copy the immich-stack service from our docker-compose.yml into your Immich's docker-compose.yml

  2. Add these environment variables to your Immich's .env file (you can also add the optional ones):

    sh
    # Immich Stack settings
    API_KEY=your_immich_api_key
    API_URL=[***]  # Use internal Docker network
    RUN_MODE=once  # Options: once, cron
    CRON_INTERVAL=86400  # in seconds, only used if RUN_MODE=cron
    
  3. Add the service dependency in Immich's docker-compose.yml:

    yaml
    immich-stack:
      container_name: immich_stack
      image: ghcr.io/majorfi/immich-stack:latest
      environment:
        - API_KEY=${API_KEY}
        - API_URL=${API_URL:-[***]}
        - DRY_RUN=${DRY_RUN:-false}
        - RESET_STACKS=${RESET_STACKS:-false}
        - REPLACE_STACKS=${REPLACE_STACKS:-false}
        - PARENT_FILENAME_PROMOTE=${PARENT_FILENAME_PROMOTE:-edit}
        - PARENT_EXT_PROMOTE=${PARENT_EXT_PROMOTE:-.jpg,.dng}
        - WITH_ARCHIVED=${WITH_ARCHIVED:-false}
        - WITH_DELETED=${WITH_DELETED:-false}
        - RUN_MODE=${RUN_MODE:-once}
        - CRON_INTERVAL=${CRON_INTERVAL:-86400}
      volumes:
        - ./logs:/app/logs
      restart: on-failure
      depends_on:
        immich-server:
          condition: service_healthy
    
  4. Restart your Immich stack:

    sh
    docker compose down
    docker compose up -d
    

Running

  1. Create a .env file in your working directory with your Immich credentials:

    sh
    API_KEY=your_immich_api_key
    API_URL=[***]
    
  2. Run the stacker:

    sh
    # Using the binary
    ./immich-stack
    
    # Or if installed in PATH
    immich-stack
    
  3. Optional: Configure additional options via environment variables or flags:

    sh
    # Example with flags
    ./immich-stack --dry-run --parent-filename-promote=edit --parent-ext-promote=.jpg,.dng --with-archived --with-deleted
    
    # Or using environment variables
    export DRY_RUN=true
    export PARENT_FILENAME_PROMOTE=edit
    export PARENT_EXT_PROMOTE=.jpg,.dng
    export WITH_ARCHIVED=true
    export WITH_DELETED=true
    ./immich-stack
    

Directory Structure

immich-auto-stack/
├── cmd/                # CLI entrypoint (main.go)
├── pkg/
│   ├── stacker/        # Stacking logic, types, and tests
│   ├── immich/         # Immich API client and integration
│   └── utils/          # Utility helpers and logging

CLI Usage

The main entrypoint is cmd/main.go, which provides a Cobra-based CLI:

sh
go run ./cmd/main.go --api-key <API_KEY> --api-url <API_URL> [flags]
Flags and Environment Variables
FlagEnv VarDescription
--api-keyAPI_KEYImmich API key
--api-urlAPI_URLImmich API base URL
--reset-stacksRESET_STACKSDelete all existing stacks before processing
--replace-stacksREPLACE_STACKSReplace stacks for new groups
--dry-runDRY_RUNSimulate actions without making changes
--criteriaCRITERIACustom grouping criteria
--parent-filename-promotePARENT_FILENAME_PROMOTESubstrings to promote as parent filenames
--parent-ext-promotePARENT_EXT_PROMOTEExtensions to promote as parent files
--with-archivedWITH_ARCHIVEDInclude archived assets in processing
--with-deletedWITH_DELETEDInclude deleted assets in processing
--run-modeRUN_MODERun mode: "once" (default) or "cron"
--cron-intervalCRON_INTERVALInterval in seconds for cron mode
  • Flags take precedence over environment variables.
  • If --reset-stacks is set, user confirmation is required.

Stacking Logic

Grouping
  • Default Criteria: Groups by base filename (before extension) and local capture time.
  • Custom Criteria: Override with the --criteria flag or CRITERIA environment variable.
Sorting
  • Parent Promotion: Use --parent-filename-promote or PARENT_FILENAME_PROMOTE (comma-separated substrings) to promote files as stack parents.
  • Extension Promotion: Use --parent-ext-promote or PARENT_EXT_PROMOTE (comma-separated extensions) to further prioritize.
  • Extension Rank: Built-in priority: .jpeg > .jpg > .png > others.
  • Alphabetical: Final tiebreaker.
Example

For files: L***.JPG, L***.edit.jpg, L***.DNG With PARENT_FILENAME_PROMOTE=edit and PARENT_EXT_PROMOTE=.jpg,.dng in your .env file, or with --parent-filename-promote=edit and --parent-ext-promote=.jpg,.dng, the order will be:

L***.edit.jpg
L***.JPG
L***.DNG

Library Structure

pkg/stacker
  • StackBy: Groups assets into stacks and sorts them based on promotion rules.
  • SortStack: Sorts assets in a stack by promotion and extension rules.
  • Types: Asset, Stack, Criteria, etc.
pkg/immich
  • Client: Handles all Immich API interactions (fetch, modify, delete stacks/assets).
  • FetchAllStacks: Retrieves all stacks, with reset and cleanup logic.
  • FetchAssets: Retrieves all assets, paginated.
  • ModifyStack/DeleteStack: Stack management.
  • ListDuplicates: Finds and logs duplicate assets.
pkg/utils
  • helper.go: Array comparison, string cleaning.
  • logs.go: Colorful, structured logging helpers (info, error, debug, pretty-print).

Example Workflow

  1. Fetch all stacks and assets from Immich.
  2. Group assets into stacks using criteria.
  3. Sort each stack to determine the parent and children.
  4. Apply changes via the Immich API (create, update, or delete stacks as needed).
  5. Log all actions and optionally run in dry-run mode for safety.

Testing

  • Table-driven tests for all major logic in pkg/stacker/stacker_test.go and pkg/immich/client_test.go.
  • Run with:
    sh
    go test ./pkg/...
    

Extending

  • Custom Grouping: Edit or override criteria via command-line flags or environment variables.
  • Custom Promotion: Set --parent-filename-promote and/or --parent-ext-promote for your workflow.
  • API Integration: Extend pkg/immich/client.go for new Immich endpoints.

Contributing

  • Follow the code style and comment conventions (see code for examples).
  • Add tests for new features.
  • Document all exported functions and types.

License

MIT

查看更多 immich-stack 相关镜像 →
localstack/localstack logo
localstack/localstack
by LocalStack GmbH
LocalStack是一款可在单个容器中运行的云服务模拟器,支持在本地离线运行AWS应用程序或Lambda函数,无需连接远程云提供商,加速云应用的测试与开发工作流程。
340100M+ pulls
上次更新:10 小时前
redis/redis-stack logo
redis/redis-stack
by Redis
认证
Redis Stack是一个集成方案,它安装Redis服务器并赋予其额外的数据库功能,如搜索、JSON数据处理、时间序列管理等,同时包含RedisInsight这一可视化管理工具,帮助用户便捷部署、监控和管理Redis数据库,有效提升开发与运维效率。
15810M+ pulls
上次更新:2 个月前
localstack/localstack-pro logo
localstack/localstack-pro
by LocalStack GmbH
LocalStack Pro是一款易用的云模拟框架,适用于开发、测试和实验场景。
411M+ pulls
上次更新:14 小时前
redis/redis-stack-server logo
redis/redis-stack-server
by Redis
认证
redis-stack-server是一款用于安装Redis服务器的工具,它在标准Redis服务器的基础上,集成了多种额外的数据库功能,包括对JSON数据类型的原生支持、高效的全文搜索能力、时间序列数据的专门管理机制以及概率数据结构(如布隆过滤器)等,这些扩展功能显著增强了Redis的数据处理多样性和应用灵活性,使其能够更好地满足实时数据分析、内容检索、多模型数据存储等复杂场景的需求。
9910M+ pulls
上次更新:2 个月前
blockstack/stacks-core logo
blockstack/stacks-core
by Stacks Foundation
暂无描述
110K+ pulls
上次更新:25 天前
stackhawk/hawkscan logo
stackhawk/hawkscan
by StackHawk
认证
StackHawk提供从开发到生产环境的动态应用漏洞扫描。
211M+ pulls
上次更新:2 天前

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

登录仓库拉取

通过 Docker 登录认证访问私有仓库

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

Docker Compose

Docker Compose 项目配置

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

宝塔面板

在宝塔面板一键配置镜像

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

极空间

极空间 NAS 系统配置服务

爱快路由

爱快 iKuai 路由系统配置

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

专属域名拉取

无需登录使用专属域名

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

轩辕镜像免费版与专业版有什么区别?

免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

轩辕镜像支持哪些镜像仓库?

专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

oldzhang的头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
majorfi/immich-stack
官方博客Docker 镜像使用技巧与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
提交工单
免费获取在线技术支持请 提交工单,官方QQ群:13763429 。
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
免费获取在线技术支持请提交工单,官方QQ群: 。
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动
官方邮箱:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.
轩辕镜像 官方专业版 Logo
轩辕镜像轩辕镜像官方专业版
首页个人中心搜索镜像
交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 13763429