-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (39 loc) · 1.52 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (39 loc) · 1.52 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
# ============================================================
# Stage 1: Build
# ============================================================
FROM node:22-alpine AS builder
# Install pnpm
RUN corepack enable && corepack prepare pnpm@10 --activate
WORKDIR /app
# Copy manifests first to leverage layer cache
COPY package.json pnpm-lock.yaml ./
# Install ALL dependencies (including dev) for building
RUN pnpm install --frozen-lockfile
# Copy source
COPY . .
# Production build
RUN pnpm build
# ============================================================
# Stage 2: Production runtime
# ============================================================
FROM node:22-alpine AS runtime
# Security: run as non-root user
RUN addgroup -S openclaw && adduser -S openclaw -G openclaw
WORKDIR /app
# Copy only what's needed to run the static server
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/bin ./bin
COPY --from=builder /app/package.json ./package.json
# Install only the Node built-in dependencies needed (no extra npm packages needed
# by bin/openclaw-office.js — it only uses node:http, node:fs, node:path, node:os)
# No production deps needed beyond Node itself.
# Switch to non-root
USER openclaw
# Default environment
ENV PORT=5180
ENV HOST=0.0.0.0
# OPENCLAW_GATEWAY_URL and OPENCLAW_GATEWAY_TOKEN should be provided at runtime
EXPOSE 5180
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:${PORT}/ > /dev/null || exit 1
ENTRYPOINT ["node", "bin/openclaw-office.js"]