fix: enable community repo, fix duf install arch mapping, force-load all zinit plugins

This commit is contained in:
luochen570
2026-07-14 23:25:36 +08:00
parent 378ec90d1e
commit 0976909e65

View File

@@ -5,17 +5,28 @@ 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.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" LABEL org.opencontainers.image.source="https://git.luochen570.cn/luochen570/luochen570-cli"
# ---- Enable community repo ----
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v3.24/community" >> /etc/apk/repositories
# ---- Install Alpine packages ---- # ---- Install Alpine packages ----
RUN apk add --no-cache \ RUN apk add --no-cache \
# Core # Core
zsh git curl ca-certificates openssl shadow-utils \ zsh git curl ca-certificates openssl shadow \
# CLI tools # CLI tools (some from community repo)
eza fzf duf ncdu yazi bat tree \ eza fzf ncdu yazi bat tree \
# neovim (for NvChad) # neovim (for NvChad)
neovim \ neovim \
# runtime deps # runtime deps
tmux tmux
# ---- Install duf from GitHub (not in Alpine repos) ----
ARG TARGETARCH
ARG DUF_VERSION=0.9.1
RUN DUF_ARCH="${TARGETARCH}" \
&& [ "${DUF_ARCH}" = "amd64" ] && DUF_ARCH="x86_64" \
&& curl -fsSL "https://github.com/muesli/duf/releases/download/v${DUF_VERSION}/duf_${DUF_VERSION}_linux_${DUF_ARCH}.tar.gz" \
| tar xz -C /usr/local/bin duf
# ---- Set up zinit (zsh plugin manager) ---- # ---- Set up zinit (zsh plugin manager) ----
ENV ZINIT_HOME=/root/.local/share/zinit/zinit.git ENV ZINIT_HOME=/root/.local/share/zinit/zinit.git
RUN mkdir -p "$(dirname "$ZINIT_HOME")" \ RUN mkdir -p "$(dirname "$ZINIT_HOME")" \
@@ -25,8 +36,22 @@ RUN mkdir -p "$(dirname "$ZINIT_HOME")" \
COPY configs/.zshrc /root/.zshrc COPY configs/.zshrc /root/.zshrc
COPY configs/.p10k.zsh /root/.p10k.zsh COPY configs/.p10k.zsh /root/.p10k.zsh
# ---- Pre-install zinit plugins ---- # ---- Pre-install zinit plugins (including deferred/wait plugins) ----
RUN zsh -c 'source /root/.zshrc 2>/dev/null; zinit update --all 2>/dev/null || true' RUN zsh -c 'source /root/.zshrc 2>/dev/null; \
zpcdreplay 2>/dev/null; \
zinit update --all 2>/dev/null; \
# Force-load deferred plugins to ensure they are cloned
for plugin in \
zdharma-continuum/fast-syntax-highlighting \
zsh-users/zsh-autosuggestions; do \
zinit light "$plugin" 2>/dev/null; \
done; \
# Force-load deferred OMZ snippets
for snippet in sudo z git extract kubectl colored-man-pages; do \
zinit snippet "OMZP::${snippet}" 2>/dev/null; \
done; \
zinit update --all 2>/dev/null; \
exit 0'
# ---- Set up NvChad (neovim IDE config) ---- # ---- Set up NvChad (neovim IDE config) ----
RUN git clone --depth 1 https://github.com/NvChad/starter /root/.config/nvim \ RUN git clone --depth 1 https://github.com/NvChad/starter /root/.config/nvim \