# 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"]
