Initial: luochen570-cli Docker image with zsh+zinit+NvChad+CLI tools

- Alpine-based Docker image
- zsh + zinit + Powerlevel10k
- zsh-autosuggestions, fast-syntax-highlighting
- CLI tools: yazi, eza, fzf, duf, ncdu, bat, tree, tmux
- NvChad (neovim IDE config)
- Weekly Gitea Actions build workflow (multi-arch)
- Gitea Container Registry publishing
This commit is contained in:
luochen570
2026-07-14 23:20:14 +08:00
commit 378ec90d1e
6 changed files with 2156 additions and 0 deletions

17
.dockerignore Normal file
View File

@@ -0,0 +1,17 @@
# Git
.git/
.gitignore
# Docker
Dockerfile
.dockerignore
README.md
.gitea/
# macOS
.DS_Store
# Editor
*.swp
*.swo
*~

View File

@@ -0,0 +1,43 @@
name: build-weekly
on:
schedule:
- cron: '0 8 * * 0' # 每周日 UTC 8:00 (北京时间 16:00)
workflow_dispatch: # 支持手动触发
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL%/}/${GITHUB_REPOSITORY}.git"
git -c http.extraheader="Authorization: token ${{ secrets.CHECKOUT_TOKEN }}" \
fetch --depth=1 origin "${GITHUB_SHA}"
git checkout --force FETCH_HEAD
- name: Set up QEMU (for multi-arch build)
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: Set up Docker Buildx
run: |
docker buildx create --use --driver docker-container --name builder 2>/dev/null || true
docker buildx inspect --bootstrap
- name: Login to Gitea Container Registry
run: echo "${{ secrets.CHECKOUT_TOKEN }}" | docker login git.luochen570.cn -u luochen570 --password-stdin
- name: Build and push (multi-arch)
run: |
TAG_WEEKLY="weekly-$(date +%Y%m%d)"
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
-t "git.luochen570.cn/luochen570/luochen570-cli:latest" \
-t "git.luochen570.cn/luochen570/luochen570-cli:${TAG_WEEKLY}" \
.

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# luochen570-cli - Alpine-based CLI toolkit
FROM alpine:latest
LABEL org.opencontainers.image.title="luochen570-cli"
LABEL org.opencontainers.image.description="Alpine-based CLI toolkit: zsh+zinit plugins, NvChad, and common CLI tools"
LABEL org.opencontainers.image.source="https://git.luochen570.cn/luochen570/luochen570-cli"
# ---- Install Alpine packages ----
RUN apk add --no-cache \
# Core
zsh git curl ca-certificates openssl shadow-utils \
# CLI tools
eza fzf duf ncdu yazi bat tree \
# neovim (for NvChad)
neovim \
# runtime deps
tmux
# ---- Set up zinit (zsh plugin manager) ----
ENV ZINIT_HOME=/root/.local/share/zinit/zinit.git
RUN mkdir -p "$(dirname "$ZINIT_HOME")" \
&& git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
# ---- Copy zsh configs ----
COPY configs/.zshrc /root/.zshrc
COPY configs/.p10k.zsh /root/.p10k.zsh
# ---- Pre-install zinit plugins ----
RUN zsh -c 'source /root/.zshrc 2>/dev/null; zinit update --all 2>/dev/null || true'
# ---- Set up NvChad (neovim IDE config) ----
RUN git clone --depth 1 https://github.com/NvChad/starter /root/.config/nvim \
&& rm -rf /root/.config/nvim/.git
# ---- Set default shell ----
SHELL ["/bin/zsh", "-c"]
ENV SHELL=/bin/zsh
CMD ["/bin/zsh"]

47
README.md Normal file
View File

@@ -0,0 +1,47 @@
# luochen570-cli
Alpine-based 自用 CLI 工具镜像 —— zsh + zinit 插件 + NvChad + 常用 CLI 工具
## 包含的工具
| 类别 | 工具 |
|------|------|
| Shell | zsh, zinit, Powerlevel10k, zsh-autosuggestions, fast-syntax-highlighting |
| 文件管理 | yazi, eza, bat, tree, duf, ncdu |
| 搜索 | fzf, ack |
| 编辑器 | Neovim + NvChad starter |
| 版本控制 | git |
| 多路复用 | tmux |
## 镜像拉取
```bash
docker pull git.luochen570.cn/luochen570/luochen570-cli:latest
```
## 使用
```bash
# 交互式 zsh
docker run -it --rm git.luochen570.cn/luochen570/luochen570-cli
# 挂载当前目录工作
docker run -it --rm -v "$PWD:/workspace" -w /workspace \
git.luochen570.cn/luochen570/luochen570-cli
# NvChad (neovim)
docker run -it --rm git.luochen570.cn/luochen570/luochen570-cli nvim
```
## 构建
每周自动构建(周日 UTC 8:00推送到 Gitea Container Registry。
也支持手动触发Gitea → Actions → build-weekly → Run workflow。
## 本地构建
```bash
docker buildx build --platform linux/amd64,linux/arm64 \
-t git.luochen570.cn/luochen570/luochen570-cli:latest \
--push .
```

1840
configs/.p10k.zsh Normal file

File diff suppressed because it is too large Load Diff

171
configs/.zshrc Normal file
View File

@@ -0,0 +1,171 @@
# Powerlevel10k instant prompt. Keep near the top of ~/.zshrc.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Environment
path=(~/.local/bin $path)
typeset -x XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
# Shell options
setopt correct
setopt interactive_comments
# Load zinit and OMZ libs
load_omz_lib() {
local i
for i in theme-and-appearance.zsh git.zsh prompt_info_functions.zsh history.zsh; do
zinit snippet "OMZL::${i}"
done
for i in completion.zsh key-bindings.zsh; do
zinit ice lucid wait="1"
zinit snippet "OMZL::${i}"
done
}
load_zinit_compinit_function() {
zpcompinit
zpcdreplay
}
# Install zinit manually (official way) with GitHub proxy for China mainland
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[[ ! -d "${ZINIT_HOME}" ]] && mkdir -p "$(dirname "${ZINIT_HOME}")"
[[ ! -d "${ZINIT_HOME}/.git" ]] && git clone https://gh-proxy.org/https://github.com/zdharma-continuum/zinit.git "${ZINIT_HOME}"
source "${ZINIT_HOME}/zinit.zsh"
load_omz_lib
# Theme: Powerlevel10k
zinit ice depth=1
zinit light romkatv/powerlevel10k
skip_global_compinit=1
load_zinit_compinit_function
# Plugins (zinit official style)
# command-not-found: command missing 时提示可安装的软件包
if [[ -e /usr/lib/command-not-found ]]; then
zinit ice lucid wait="0"
zinit snippet OMZP::command-not-found
fi
# colored-man-pages: man 页面彩色高亮
zinit ice lucid wait="3"
zinit snippet OMZP::colored-man-pages
# fast-syntax-highlighting: 命令行语法高亮
zinit ice wait lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay"
zinit light zdharma-continuum/fast-syntax-highlighting
# zsh-autosuggestions: 基于历史记录的命令自动建议
zinit ice wait lucid atload"_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions
# sudo: 双击 ESC 为当前命令加 sudo 前缀
zinit ice lucid wait="2"
zinit snippet OMZP::sudo
# z: 目录访问频率跳转
zinit ice lucid wait="1"
zinit snippet OMZP::z
unsetopt BG_NICE
# git: 提供 git 常用别名与函数
zinit ice lucid wait="1"
zinit snippet OMZP::git
# extract: 一条命令解压多种压缩格式,并加载其补全
zinit ice lucid wait="1"
zinit snippet OMZP::extract
# OMZ kubectl: kubectl 别名、补全与辅助函数
zinit ice lucid wait="1"
zinit snippet OMZP::kubectl
# Powerlevel10k config
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Aliases
alias ...=../..
alias ....=../../..
alias .....=../../../..
alias ......=../../../../..
alias 1='cd -'
alias 2='cd -2'
alias 3='cd -3'
alias 4='cd -4'
alias 5='cd -5'
alias 6='cd -6'
alias 7='cd -7'
alias 8='cd -8'
alias 9='cd -9'
alias _='sudo '
alias afind='ack -il'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias gc1='git clone --recursive --depth=1'
alias globurl='noglob urlglobber '
alias grep='grep --color=auto'
alias md='mkdir -p'
alias rd='rmdir'
alias cat='batcat --style=plain --paging=never'
alias ccat='/usr/bin/cat'
if [[ -n "$(command -v eza)" ]]; then
DISABLE_LS_COLORS=true
alias ls='eza --color=auto'
alias l='eza -lbah --icons=auto'
alias la='eza -labgh --icons=auto'
alias ll='eza -lbg --icons=auto'
alias lt='eza -lTbg --icons=auto'
alias lsa='eza -lbagR --icons=auto'
alias lst='eza -lTabgh --icons=auto'
else
alias ls='ls --color=auto'
alias l='ls -lah'
alias la='ls -lAh'
alias ll='ls -lh'
alias lsa='ls -lah'
alias lst='tree -pCsh'
fi
# yazi: open and jump to last cwd
function y() {
local tmp cwd
tmp="$(mktemp -t yazi-cwd.XXXXXX)"
yazi "$@" --cwd-file="$tmp"
cwd="$(cat -- "$tmp")"
if [[ -n "$cwd" && "$cwd" != "$PWD" ]]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# uv: Python package manager自动补全
if (( $+commands[uv] )); then
eval "$(uv generate-shell-completion zsh)"
fi
# Required packages
# - zsh
# - git
# - zinit
# - powerlevel10k
# - eza (optional, for modern ls aliases)
# - tree (optional, fallback for lst alias)
# - ack (optional, for afind alias)
# - yazi (terminal file manager)
# - uv (Python package manager)
# - kubectl (for OMZ kubectl plugin)
# - command-not-found (optional, distro package name may vary)
# - bat or batcat (optional, if you later add bat aliases)
# pnpm
export PNPM_HOME="/root/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME/bin:*) ;;
*) export PATH="$PNPM_HOME/bin:$PATH" ;;
esac
# pnpm end
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).