forked from vignesh07/clawdbot-railway-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
129 lines (102 loc) · 4.43 KB
/
Dockerfile
File metadata and controls
129 lines (102 loc) · 4.43 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
127
128
129
# Build openclaw from source to avoid npm packaging gaps (some dist files are not shipped).
FROM node:22-bookworm AS openclaw-build
# Dependencies needed for openclaw build
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
ca-certificates \
curl \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Install Bun (openclaw build uses it)
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
RUN corepack enable
WORKDIR /openclaw
# Pin to a known-good ref (tag/branch). Override in Railway template settings if needed.
# Using a released tag avoids build breakage when `main` temporarily references unpublished packages.
ARG OPENCLAW_GIT_REF=v2026.3.13-1
RUN git clone --depth 1 --branch "${OPENCLAW_GIT_REF}" https://github.com/openclaw/openclaw.git .
# Patch: relax version requirements for packages that may reference unpublished versions.
# Apply to all extension package.json files to handle workspace protocol (workspace:*).
RUN set -eux; \
find ./extensions -name 'package.json' -type f | while read -r f; do \
sed -i -E 's/"openclaw"[[:space:]]*:[[:space:]]*">=[^"]+"/"openclaw": "*"/g' "$f"; \
sed -i -E 's/"openclaw"[[:space:]]*:[[:space:]]*"workspace:[^"]+"/"openclaw": "*"/g' "$f"; \
done
RUN pnpm install --no-frozen-lockfile
RUN pnpm build
ENV OPENCLAW_PREFER_PNPM=1
RUN pnpm ui:install && pnpm ui:build
# Runtime image
FROM node:22-bookworm
ENV NODE_ENV=production
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
jq \
curl \
gnupg \
lsb-release \
&& rm -rf /var/lib/apt/lists/*
# --- Custom packages for WarforgeTech deployments ---
# gog (Gmail CLI) — for Gmail PubSub automation
RUN curl -fsSL https://gogcli.sh/install.sh | bash \
|| echo "WARNING: gog install failed — may need manual install"
# Tailscale — for Funnel-based port routing
RUN curl -fsSL https://tailscale.com/install.sh | bash
# Google Cloud CLI — for GCP integrations
RUN curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
> /etc/apt/sources.list.d/google-cloud-sdk.list && \
apt-get update && \
apt-get install -y --no-install-recommends google-cloud-cli && \
rm -rf /var/lib/apt/lists/*
# --- Skill dependencies ---
# GitHub CLI — for github skill
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| dd of=/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 \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gh \
ffmpeg \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# uv (Python package manager) — for nano-pdf, nano-banana-pro, markdown-converter
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
# Python-based skill tools
RUN uv tool install yt-dlp \
&& uv tool install nano-pdf \
&& uv tool install markitdown
# Symlink uv tools to /usr/local/bin (Railway overrides PATH, /root/.local/bin not in it)
RUN ln -sf /root/.local/bin/uv /usr/local/bin/uv \
&& ln -sf /root/.local/bin/uvx /usr/local/bin/uvx \
&& ln -sf /root/.local/bin/yt-dlp /usr/local/bin/yt-dlp \
&& ln -sf /root/.local/bin/nano-pdf /usr/local/bin/nano-pdf \
&& ln -sf /root/.local/bin/markitdown /usr/local/bin/markitdown
# mcporter — MCP server integration skill
RUN npm i -g mcporter
# `openclaw update` expects pnpm. Provide it in the runtime image.
RUN corepack enable && corepack prepare pnpm@10.23.0 --activate
WORKDIR /app
# Wrapper deps
COPY package.json ./
RUN npm install --omit=dev && npm cache clean --force
# Copy built openclaw
COPY --from=openclaw-build /openclaw /openclaw
# Provide an openclaw executable
RUN printf '%s\n' '#!/usr/bin/env bash' 'exec node /openclaw/dist/entry.js "$@"' > /usr/local/bin/openclaw \
&& chmod +x /usr/local/bin/openclaw
COPY src ./src
# The wrapper listens on this port.
ENV OPENCLAW_PUBLIC_PORT=8080
ENV PORT=8080
EXPOSE 8080
CMD ["node", "src/server.js"]