Files
nas-tools/claude-dev/Dockerfile
T
Gan, Jimmy d19707422d
Deploy Claude Dev (Dev) / deploy-claude-dev-dev (push) Failing after 40s
feat: add tea (Gitea CLI) to claude-dev tooling
2026-03-15 23:00:57 +08:00

71 lines
2.1 KiB
Docker

FROM node:20-bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
fd-find \
gh \
git \
jq \
make \
openssh-client \
python3 \
ripgrep \
rsync \
tmux \
unzip \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/bin/fdfind /usr/local/bin/fd
ARG YQ_VERSION=v4.44.6
RUN wget -q -O /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" \
&& chmod +x /usr/local/bin/yq
ARG TEA_VERSION=0.12.0
RUN wget -q -O /tmp/tea.tar.gz "https://dl.gitea.com/tea/${TEA_VERSION}/tea-${TEA_VERSION}-linux-amd64.tar.gz" \
&& tar -xzf /tmp/tea.tar.gz -C /tmp \
&& mv /tmp/tea-${TEA_VERSION}-linux-amd64/tea /usr/local/bin/tea \
&& chmod +x /usr/local/bin/tea \
&& rm -rf /tmp/tea.tar.gz /tmp/tea-${TEA_VERSION}-linux-amd64
RUN npm install -g @anthropic-ai/claude-code
RUN python3 - <<'PY'
from pathlib import Path
import re
path = Path("/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js")
if not path.exists():
raise SystemExit(f"claude cli not found: {path}")
content = path.read_text()
pattern = r'let A=U7\(\),q=new URL\(A\.TOKEN_URL\),K=\[`\$\{A\.BASE_API_URL\}/api/hello`,`\$\{q\.origin\}/v1/oauth/hello`\],Y=async\(_\)=>\{try\{let \$=await I8\.get\(_,\{headers:\{"User-Agent":ey\(\)\}\}\);if\(\$\.status!==200\)return\{success:!1,error:`Failed to connect to \$\{new URL\(_\)\.hostname\}: Status \$\{\$\.status\}`\};return\{success:!0\}\}catch\(\$\)\{'
replacement = 'return'
patched, count = re.subn(pattern, replacement, content, count=1)
if count != 1:
raise SystemExit("preflight patch target not found in claude cli; refusing to build")
path.write_text(patched)
if re.search(pattern, path.read_text()):
raise SystemExit("preflight patch did not apply cleanly")
print("Applied Claude preflight bypass patch")
PY
WORKDIR /repos/nas-tools
COPY required-tools.txt /opt/claude-dev/required-tools.txt
COPY scripts /opt/claude-dev/scripts
RUN chmod +x /opt/claude-dev/scripts/*.sh
CMD ["bash"]