-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathDockerfile.anydev
More file actions
126 lines (101 loc) · 4.5 KB
/
Dockerfile.anydev
File metadata and controls
126 lines (101 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# =============================================================================
# AgentStudio AnyDev Template Image
# =============================================================================
#
# Cloud development environment for AnyDev (devc.woa.com).
# Pre-installs Node.js 20, pnpm, and AgentStudio (built, ready to run).
#
# The init command in the AnyDev template will start AgentStudio as a
# background service. Users configure API keys via the AgentStudio UI.
#
# Build:
# docker build -f Dockerfile.anydev -t mirrors.tencent.com/clawstudio/clawstudio:latest .
#
# =============================================================================
# -----------------------------------------------------------------------------
# Stage 1: Build
# -----------------------------------------------------------------------------
FROM node:20-slim AS builder
RUN sed -i 's|http://deb.debian.org|http://mirrors.tencent.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null; \
sed -i 's|http://deb.debian.org|http://mirrors.tencent.com|g' /etc/apt/sources.list 2>/dev/null; true
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g pnpm@10
WORKDIR /build
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml* ./
COPY frontend/package.json ./frontend/
COPY backend/package.json ./backend/
RUN pnpm install --frozen-lockfile || pnpm install
COPY frontend ./frontend
COPY backend ./backend
COPY tsconfig.json ./
ENV NODE_OPTIONS="--max-old-space-size=3072"
RUN cd frontend && VITE_API_BASE=/api pnpm run build
RUN cd backend && pnpm run build
# -----------------------------------------------------------------------------
# Stage 2: AnyDev Runtime (root user, persistent dev environment)
# -----------------------------------------------------------------------------
FROM node:20-slim
RUN sed -i 's|http://deb.debian.org|http://mirrors.tencent.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null; \
sed -i 's|http://deb.debian.org|http://mirrors.tencent.com|g' /etc/apt/sources.list 2>/dev/null; true
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
vim \
nano \
openssh-client \
python3 \
python3-venv \
procps \
net-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install uv (Python package manager) via official installer
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
ln -sf /root/.local/bin/uv /usr/local/bin/uv && \
ln -sf /root/.local/bin/uvx /usr/local/bin/uvx
RUN npm install -g pnpm@10 pm2
# --- Install claude-internal CLI (Tencent internal registry) ---
RUN npm install -g @tencent/claude-code-internal --registry=https://mirrors.tencent.com/npm/ || \
echo "Warning: claude-internal CLI install failed, will need manual install"
# --- Install AgentStudio ---
WORKDIR /opt/clawstudio
COPY --from=builder /build/package.json /build/pnpm-workspace.yaml /build/pnpm-lock.yaml* ./
COPY --from=builder /build/frontend/package.json ./frontend/
COPY --from=builder /build/backend/package.json ./backend/
WORKDIR /opt/clawstudio/backend
RUN pnpm install --prod --frozen-lockfile || pnpm install --prod
COPY --from=builder /build/frontend/dist /opt/clawstudio/frontend/dist
COPY --from=builder /build/backend/dist /opt/clawstudio/backend/dist
RUN mkdir -p /opt/clawstudio/backend/public && \
cp -r /opt/clawstudio/frontend/dist/* /opt/clawstudio/backend/public/
# --- Unified HOME directory ---
# Both terminal sessions and the backend process use HOME=/data.
# This ensures claude-internal credential paths are consistent:
# os.homedir() always returns /data, so credentials land in /data/.claude-internal/
# /data is AnyDev's persistent volume, so user configs survive container restarts.
RUN echo 'export HOME=/data' >> /root/.bashrc && \
echo 'export HOME=/data' >> /root/.profile && \
echo 'export HOME=/data' >> /etc/profile.d/home-data.sh
# --- Copy runtime scripts ---
COPY docker/anydev-init.sh /opt/clawstudio/anydev-init.sh
COPY docker/ecosystem.config.cjs /opt/clawstudio/ecosystem.config.cjs
COPY docker/register-anydev.sh /opt/clawstudio/register-anydev.sh
COPY docker/entrypoint.sh /opt/clawstudio/entrypoint.sh
RUN chmod +x /opt/clawstudio/anydev-init.sh \
/opt/clawstudio/register-anydev.sh \
/opt/clawstudio/entrypoint.sh
ENV NODE_ENV=production \
PORT=80 \
HOST=0.0.0.0 \
HOME=/data \
ENGINE=claude-internal-sdk
EXPOSE 80
ENTRYPOINT ["/opt/clawstudio/entrypoint.sh"]
WORKDIR /data