Commit 412d4f98 412d4f980b3b0f619657e127b014c40b862969db by cnb.bofCdSsphPA

default env

0 parents
FROM debian:13.4
RUN sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources
RUN apt-get update && \
apt-get install -y wget unzip lsof nload htop net-tools dnsutils openssh-server \
build-essential curl git gcc libc6-dev \
pkg-config libssl-dev ca-certificates vim ripgrep jq sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash user && \
echo "user:user" | chpasswd && \
adduser user sudo
RUN echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER user
# Install code-server and extensions
RUN curl -fsSL https://code-server.dev/install.sh | sudo sh \
&& code-server --install-extension golang.go \
&& code-server --install-extension cnbcool.cnb-welcome \
&& code-server --install-extension formulahendry.code-runner \
&& code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools \
&& code-server --install-extension tencent-cloud.coding-copilot \
&& code-server --install-extension github.github-vscode-theme \
&& code-server --install-extension ms-ceintl.vscode-language-pack-zh-hans \
&& code-server --install-extension eddieposey.vscode-icons-mac \
&& code-server --install-extension oderwat.indent-rainbow \
&& code-server --install-extension yzhang.markdown-all-in-one
# leetcode.vscode-leetcode
#RUN wget -c -N "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/panxiaoan/vsextensions/themes-falcon-vscode/3.0.1/vspackage" -O panxiaoan.themes-falcon-vscode-3.0.1.vsix && \
# code-server --install-extension ./panxiaoan.themes-falcon-vscode-3.0.1.vsix
ENV TZ=Asia/Shanghai
ENV GIT_TERMINAL_PROMPT=0
RUN sudo apt-get -y update && sudo apt-get -y install hx wget curl git git-lfs zsh tmux tzdata && \
RUNZSH=no CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
sudo apt-get install -y locales \
&& sudo rm -rf /var/lib/apt/lists/* \
&& sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& sudo localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8 \
&& sudo dpkg-reconfigure --frontend=noninteractive locales
RUN sudo /usr/bin/chsh -s $(which zsh)
ENV LANG=zh_CN.UTF-8
ENV LANGUAGE=zh_CN:zh
# ENV LC_ALL=zh_CN.UTF-8
RUN wget -c -N https://github.com/neovim/neovim/releases/download/v0.12.2/nvim-linux-x86_64.tar.gz && \
sudo tar xf nvim-linux-x86_64.tar.gz -C /usr/local && \
sudo ln -sf /usr/local/nvim-linux-x86_64/bin/nvim /usr/bin/nvim
RUN cd /home/user && git clone --single-branch https://github.com/gpakosz/.tmux.git && \
ln -s -f .tmux/.tmux.conf && cp .tmux/.tmux.conf.local .
# !/usr/bin/env bash
set -euo pipefail
CLAUDE_CONFIG_DIR=${CLAUDE_CONFIG_DIR:-"${HOME}/.claude"}
BOOTSTRAP_MARKER=${BOOTSTRAP_MARKER:-"${CLAUDE_CONFIG_DIR}/.bootstrap-plugins-done"}
CLAUDE_FORCE_PLUGIN_BOOTSTRAP=${CLAUDE_FORCE_PLUGIN_BOOTSTRAP:-0}
CLAUDE_SKIP_SETTINGS_INIT=${CLAUDE_SKIP_SETTINGS_INIT:-0}
CLAUDE_ENABLE_THIRD_PARTY=${CLAUDE_ENABLE_THIRD_PARTY:-0}
DEFAULT_PLUGIN_LIST="superpowers pr-review-toolkit claude-code-setup ralph-loop typescript-lsp rust-analyzer-lsp"
CLAUDE_PLUGIN_LIST=${CLAUDE_PLUGIN_LIST:-"$DEFAULT_PLUGIN_LIST"}
require_claude() {
if ! command -v claude >/dev/null 2>&1; then
echo "[error] 未找到 claude 命令,请先安装 Claude Code。" >&2
exit 1
fi
}
check_auth() {
if [ -n "${ANTHROPIC_API_KEY:-}" ] || [ -n "${CLAUDE_CODE_OAUTH_TOKEN:-}" ] || [ -f "${CLAUDE_CONFIG_DIR}/.credentials.json" ]; then
return
fi
cat <<'EOF'
[warn] 未检测到认证信息。
[warn] 可稍后配置以下任一方式后重跑脚本:
export ANTHROPIC_API_KEY=...
export CLAUDE_CODE_OAUTH_TOKEN=...
EOF
}
prepare_config_dir() {
mkdir -p "$CLAUDE_CONFIG_DIR"
chmod 700 "$CLAUDE_CONFIG_DIR"
}
already_bootstrapped() {
[ "$CLAUDE_FORCE_PLUGIN_BOOTSTRAP" != "1" ] && [ -f "$BOOTSTRAP_MARKER" ]
}
install_plugin() {
local plugin=$1
echo "[plugin] 安装 $plugin..."
if printf '/plugin install %s@claude-plugins-official\n/reload-plugins\n/exit\n' "$plugin" | claude >/tmp/claude-plugin-${plugin}.log 2>&1; then
echo "[plugin] $plugin 安装完成"
return 0
fi
echo "[plugin] $plugin 安装失败,详见 /tmp/claude-plugin-${plugin}.log" >&2
return 1
}
init_settings() {
local settings_file="${CLAUDE_CONFIG_DIR}/settings.json"
if [ "$CLAUDE_SKIP_SETTINGS_INIT" = "1" ] || [ -f "$settings_file" ]; then
return
fi
cat >"$settings_file" <<'EOF'
{
"modelType": "anthropic",
"alwaysThinkingEnabled": false,
"skipDangerousModePermissionPrompt": true,
"permissions": {
"allow": [
"git status",
"git diff",
"git log",
"ls",
"pwd"
],
"deny": []
}
}
EOF
}
install_default_plugins() {
local failed=0
local plugin
echo "[info] 默认插件列表: $CLAUDE_PLUGIN_LIST"
for plugin in $CLAUDE_PLUGIN_LIST; do
if ! install_plugin "$plugin"; then
failed=1
fi
done
if [ "$CLAUDE_ENABLE_THIRD_PARTY" = "1" ]; then
echo "[info] 已启用第三方扩展位,但当前未配置第三方插件。"
fi
return "$failed"
}
write_marker() {
date -u +"%Y-%m-%dT%H:%M:%SZ" >"$BOOTSTRAP_MARKER"
}
main() {
require_claude
prepare_config_dir
check_auth
if already_bootstrapped; then
echo "[info] 检测到已完成 bootstrap,跳过。"
return
fi
install_default_plugins
init_settings
write_marker
echo "[done] Claude Code 插件 bootstrap 完成。"
}
main "$@"
#!/usr/bin/env bash
set -euo pipefail
export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-noninteractive}
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
BOOTSTRAP_SCRIPT=${CLAUDE_BOOTSTRAP_SCRIPT:-"$SCRIPT_DIR/bootstrap-claude-plugins.sh"}
CLAUDE_SKIP_BOOTSTRAP=${CLAUDE_SKIP_BOOTSTRAP:-0}
require_root() {
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
echo "[error] 请使用 root 运行此脚本。" >&2
exit 1
fi
}
install_base_packages() {
echo "[1/5] 安装基础依赖..."
apt-get update
apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
jq \
less \
procps \
ripgrep \
fd-find \
python3 \
python3-venv \
python3-pip \
nodejs \
npm
}
install_claude_code() {
echo "[2/5] 配置 Claude Code 官方 apt 源..."
install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
-o /etc/apt/keyrings/claude-code.asc
chmod a+r /etc/apt/keyrings/claude-code.asc
cat >/etc/apt/sources.list.d/claude-code.list <<'EOF'
deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main
EOF
echo "[3/5] 安装 Claude Code..."
apt-get update
apt-get install -y claude-code
}
verify_install() {
echo "[4/5] 校验 Claude Code 安装..."
claude --version
}
run_bootstrap() {
if [ "$CLAUDE_SKIP_BOOTSTRAP" = "1" ]; then
echo "[5/5] 跳过插件 bootstrap。"
return
fi
if [ ! -x "$BOOTSTRAP_SCRIPT" ]; then
echo "[error] 未找到可执行 bootstrap 脚本: $BOOTSTRAP_SCRIPT" >&2
exit 1
fi
echo "[5/5] 执行默认插件 bootstrap..."
"$BOOTSTRAP_SCRIPT"
}
print_next_steps() {
cat <<'EOF'
安装完成。
认证方式二选一:
export ANTHROPIC_API_KEY=your_api_key
export CLAUDE_CODE_OAUTH_TOKEN=your_oauth_token
默认插件:
superpowers
pr-review-toolkit
claude-code-setup
ralph-loop
typescript-lsp
rust-analyzer-lsp
如需仅安装 Claude Code 而跳过插件初始化:
CLAUDE_SKIP_BOOTSTRAP=1 ./install-claude-code-debian13.sh
EOF
}
require_root
install_base_packages
install_claude_code
verify_install
run_bootstrap
print_next_steps
#!/bin.bash
cd ~
curl -sSLk https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_23.11.0-2-Linux-x86_64.sh -o Miniconda3-py310_23.11.0-2-Linux-x86_64.sh && \
bash ./Miniconda3-py310_23.11.0-2-Linux-x86_64.sh -b -p /usr/local/miniconda3
curl -sSLk https://unofficial-builds.nodejs.org/download/release/v22.22.2/node-v22.22.2-linux-x64-glibc-217.tar.gz -o node-v22.22.2-linux-x64-glibc-217.tar.gz && \
tar -xzf node-v22.22.2-linux-x64-glibc-217.tar.gz -C /usr/local/ && \
ln -sf /usr/local/node-v22.22.2-linux-x64-glibc-217/bin/node /usr/local/bin/node && \
ln -sf /usr/local/node-v22.22.2-linux-x64-glibc-217/bin/npm /usr/local/bin/npm && \
rm -rf /node-v22.22.2-linux-x64-glibc-217.tar.gz
# 安装 Bun
curl -fsSL https://bun.sh/install | bash
# 重新加载 shell 配置
source ~/.zshrc # 或 exec /usr/bin/zsh
# 验证安装
# ~/.local/bin/bun --version
npm i -g opencode-ai --registry https://mirrors.cloud.tencent.com/npm/
# cp -r ./container/helix-config /root/.config/helix