Merge pull request #1441 from trheyi/main
Update Dockerfiles to Use Ubuntu 24.04 and Enhance Package Installation
This commit is contained in:
commit
3fb23d8e85
2 changed files with 93 additions and 14 deletions
|
|
@ -1,18 +1,47 @@
|
||||||
# Base image for Yao sandbox containers
|
# Base image for Yao sandbox containers
|
||||||
# Supports both amd64 and arm64 architectures
|
# Supports both amd64 and arm64 architectures
|
||||||
FROM ubuntu:22.04
|
# Ubuntu 24.04 LTS (Noble Numbat) - supported until April 2029
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
# Avoid interactive prompts
|
# Avoid interactive prompts
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Use MIT mirror (USA) for ARM64 - much faster than default ports.ubuntu.com
|
||||||
|
RUN sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.mit.edu/ubuntu-ports|g' /etc/apt/sources.list.d/ubuntu.sources 2>/dev/null || \
|
||||||
|
sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.mit.edu/ubuntu-ports|g' /etc/apt/sources.list 2>/dev/null || true
|
||||||
|
|
||||||
# Base tools
|
# Base tools
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
|
# Essential
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
git \
|
git \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg \
|
gnupg \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
|
jq \
|
||||||
|
# Editors & viewers
|
||||||
|
vim \
|
||||||
|
less \
|
||||||
|
tree \
|
||||||
|
# Network tools
|
||||||
|
iputils-ping \
|
||||||
|
net-tools \
|
||||||
|
dnsutils \
|
||||||
|
telnet \
|
||||||
|
netcat-openbsd \
|
||||||
|
# Compression
|
||||||
|
zip \
|
||||||
|
unzip \
|
||||||
|
tar \
|
||||||
|
gzip \
|
||||||
|
# Process & system
|
||||||
|
htop \
|
||||||
|
procps \
|
||||||
|
# Text processing
|
||||||
|
sed \
|
||||||
|
gawk \
|
||||||
|
grep \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# yao-bridge (architecture-specific binary)
|
# yao-bridge (architecture-specific binary)
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,29 @@
|
||||||
# Claude sandbox image: Claude CLI + Node.js + Python
|
# Claude sandbox image: Claude CLI + Node.js + Python + CCR
|
||||||
# Supports both amd64 and arm64 architectures
|
# Supports both amd64 and arm64 architectures
|
||||||
|
# Base: Ubuntu 24.04 LTS
|
||||||
ARG REGISTRY=yaoapp
|
ARG REGISTRY=yaoapp
|
||||||
FROM ${REGISTRY}/sandbox-base:latest
|
FROM ${REGISTRY}/sandbox-base:latest
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Node.js 20 (automatically detects architecture)
|
# Use MIT mirror (USA) for ARM64 - in case base image cache is old
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
RUN sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.mit.edu/ubuntu-ports|g' /etc/apt/sources.list.d/ubuntu.sources 2>/dev/null || \
|
||||||
&& apt-get install -y nodejs \
|
sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.mit.edu/ubuntu-ports|g' /etc/apt/sources.list 2>/dev/null || true
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Python 3.11
|
# Python 3.12 (default in Ubuntu 24.04) - install first as Node.js depends on it
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
python3.11 \
|
python3 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-venv \
|
python3-venv \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& ln -sf /usr/bin/python3.11 /usr/bin/python3 \
|
|
||||||
&& ln -sf /usr/bin/python3 /usr/bin/python
|
&& ln -sf /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
# Claude CLI installation
|
# Node.js 22 LTS (automatically detects architecture)
|
||||||
# Using npm to install @anthropic-ai/claude-code globally
|
# Run apt-get update again to refresh package lists after nodesource setup
|
||||||
RUN npm install -g @anthropic-ai/claude-code || \
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||||
echo "Claude CLI installation skipped (may not be available yet)"
|
&& apt-get update \
|
||||||
|
&& apt-get install -y nodejs \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# npm global packages directory for sandbox user
|
# npm global packages directory for sandbox user
|
||||||
RUN mkdir -p /home/sandbox/.npm-global && \
|
RUN mkdir -p /home/sandbox/.npm-global && \
|
||||||
|
|
@ -34,8 +35,57 @@ USER sandbox
|
||||||
RUN npm config set prefix '/home/sandbox/.npm-global'
|
RUN npm config set prefix '/home/sandbox/.npm-global'
|
||||||
ENV PATH="/home/sandbox/.npm-global/bin:${PATH}"
|
ENV PATH="/home/sandbox/.npm-global/bin:${PATH}"
|
||||||
|
|
||||||
|
# Install Claude CLI
|
||||||
|
RUN npm install -g @anthropic-ai/claude-code || \
|
||||||
|
echo "Claude CLI installation skipped (may not be available yet)"
|
||||||
|
|
||||||
|
# Install Claude Code Router (CCR) for third-party LLM support
|
||||||
|
# Supports: DeepSeek, GLM, Volcengine, OpenRouter, etc.
|
||||||
|
RUN npm install -g @musistudio/claude-code-router
|
||||||
|
|
||||||
|
# Create CCR config directory
|
||||||
|
RUN mkdir -p /home/sandbox/.claude-code-router
|
||||||
|
|
||||||
|
# Create entrypoint script for CCR daemon mode
|
||||||
|
USER root
|
||||||
|
RUN cat > /usr/local/bin/ccr-run << 'SCRIPT'
|
||||||
|
#!/bin/bash
|
||||||
|
# CCR wrapper: starts CCR daemon and runs ccr code
|
||||||
|
# Usage: ccr-run "prompt" or ccr-run -c /path/to/config.json "prompt"
|
||||||
|
|
||||||
|
CONFIG=""
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-c|--config)
|
||||||
|
CONFIG="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Apply config if provided
|
||||||
|
if [ -n "$CONFIG" ] && [ -f "$CONFIG" ]; then
|
||||||
|
cp "$CONFIG" ~/.claude-code-router/config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start CCR daemon (nohup because ccr start -d doesn't work in containers)
|
||||||
|
nohup ccr start >/dev/null 2>&1 &
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Run ccr code
|
||||||
|
exec ccr code -p "$*"
|
||||||
|
SCRIPT
|
||||||
|
RUN chmod +x /usr/local/bin/ccr-run
|
||||||
|
|
||||||
|
USER sandbox
|
||||||
|
|
||||||
# Verify installations
|
# Verify installations
|
||||||
RUN node --version && npm --version && python3 --version
|
RUN node --version && npm --version && python3 --version && \
|
||||||
|
claude --version || true && \
|
||||||
|
ccr --version || true
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue