openclaw/secure/Dockerfile
Claude c7306b6721
feat: add Moltbot Secure edition for Railway deployment
A lean, secure, self-hosted AI assistant designed for Railway:

- Telegram-only channel (allowlist-based access control)
- Authenticated webhook receiver for external integrations
- Docker sandbox for isolated code execution
- Cron scheduler for recurring tasks
- Env-only configuration (no config files)
- Full audit logging

Core files:
- secure/config.ts - Environment-only configuration
- secure/audit.ts - Audit logging system
- secure/agent.ts - AI agent core (Anthropic/OpenAI)
- secure/telegram.ts - Telegram bot handler
- secure/webhooks.ts - Webhook receiver
- secure/sandbox.ts - Docker sandbox execution
- secure/scheduler.ts - Cron task scheduler
- secure/index.ts - Main entry point
- secure/Dockerfile - Minimal container image
- secure/railway.json - Railway deployment config

https://claude.ai/code/session_015VqJ7gN4vaxtYfYc92UjLs
2026-01-30 06:00:16 +00:00

52 lines
1.2 KiB
Docker

# Moltbot Secure - Minimal Docker Image
# Lean, secure, self-hosted AI assistant for Railway
FROM node:22-slim AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy package files
COPY package.json pnpm-lock.yaml ./
COPY secure/package.json ./secure/
# Install dependencies
RUN pnpm install --frozen-lockfile --prod=false
# Copy source
COPY secure/ ./secure/
COPY tsconfig.json ./
# Build TypeScript
RUN pnpm exec tsc --project secure/tsconfig.json
# Production image
FROM node:22-slim AS runner
# Security: Run as non-root user
RUN useradd -m -u 1000 moltbot
USER moltbot
WORKDIR /app
# Copy built files and production deps
COPY --from=builder --chown=moltbot:moltbot /app/node_modules ./node_modules
COPY --from=builder --chown=moltbot:moltbot /app/secure/dist ./dist
COPY --from=builder --chown=moltbot:moltbot /app/package.json ./
# Create data directory for audit logs
RUN mkdir -p /app/data
ENV NODE_ENV=production
ENV PORT=8080
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "fetch('http://localhost:8080/health').then(r => process.exit(r.ok ? 0 : 1))" || exit 1
CMD ["node", "dist/index.js"]