Root cause of '容器里看不到任何 SK':
- Container's /root/.claude was an isolated named volume (empty)
- Host plugins live in ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/
- installed_plugins.json embeds ABSOLUTE paths like /Users/$USER/.claude/...
which don't resolve in container
Fix:
1. docker-compose.yml
- Bind-mount ${HOME}/.claude/plugins -> /root/.claude/plugins (ro)
- Bind-mount ${HOME}/.claude/skills -> /root/.claude/skills (ro)
- Pass HOST_HOME env var
2. scripts/container-entrypoint.sh (new)
- If HOST_HOME != HOME, symlink HOST_HOME -> /root so the absolute
paths inside installed_plugins.json resolve (e.g.
/Users/gongzhiyong/.claude/... -> /root/.claude/...)
3. Dockerfile
- Install entrypoint, wire it into ENTRYPOINT via tini
Verified: all 4 installed plugins (oh-my-claudecode, superpowers,
frontend-design, planning-with-files) + 3 skills (agent-browser,
find-skills, omc-reference) visible in container.
65 lines
2.9 KiB
Docker
65 lines
2.9 KiB
Docker
FROM node:22-bookworm
|
|
|
|
ARG TARGETARCH
|
|
ARG GO_VERSION=1.25.0
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
PATH=/usr/local/go/bin:/root/go/bin:/root/.bun/bin:/root/.local/bin:$PATH \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=off \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=on
|
|
|
|
# 换成清华 Debian 镜像(国内网络更稳)+ apt 重试策略
|
|
RUN sed -i 's|http://deb.debian.org|https://mirrors.tuna.tsinghua.edu.cn|g; s|http://security.debian.org|https://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources \
|
|
&& echo 'Acquire::Retries "8";' > /etc/apt/apt.conf.d/80-retries \
|
|
&& echo 'Acquire::http::Timeout "60";' >> /etc/apt/apt.conf.d/80-retries \
|
|
&& echo 'Acquire::https::Timeout "60";' >> /etc/apt/apt.conf.d/80-retries
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
|
|
git curl ca-certificates gnupg lsb-release \
|
|
make build-essential \
|
|
python3 python3-pip python3-venv python3-dev \
|
|
postgresql-client redis-tools \
|
|
jq ripgrep fd-find less vim-tiny tini \
|
|
&& ln -s /usr/bin/fdfind /usr/local/bin/fd \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz" \
|
|
| tar -C /usr/local -xz
|
|
|
|
RUN curl -fsSL https://bun.sh/install | bash
|
|
|
|
RUN npm install -g pnpm@latest @anthropic-ai/claude-code
|
|
|
|
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
|
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
|
> /etc/apt/sources.list.d/github-cli.list \
|
|
&& apt-get update && apt-get install -y --no-install-recommends gh \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Azure CLI(用于 azure-aca-expert agent 的只读查询)
|
|
RUN curl -sL https://packages.microsoft.com/keys/microsoft.asc \
|
|
| gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null \
|
|
&& AZ_REPO=$(lsb_release -cs) \
|
|
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" \
|
|
> /etc/apt/sources.list.d/azure-cli.list \
|
|
&& apt-get update && apt-get install -y --no-install-recommends azure-cli \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN pip install --break-system-packages --no-cache-dir \
|
|
uv ruff black pytest pytest-asyncio httpx
|
|
|
|
RUN git config --system --add safe.directory '*' \
|
|
&& git config --system pull.rebase false \
|
|
&& git config --system init.defaultBranch main
|
|
|
|
COPY scripts/container-entrypoint.sh /usr/local/bin/container-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/container-entrypoint.sh
|
|
|
|
WORKDIR /workspace
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/container-entrypoint.sh"]
|
|
CMD ["claude"]
|