Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript
3.3 KB
Raw Blame
# MCP Host Dockerfile — Slim variant
# Base: node:24.22.1-slim (Debian bookworm slim, glibc + apt, ~200-250MB)
# Use case: agent shell execution with common Unix tools
#
# BUILD CONTEXT = repo root (see Dockerfile). COPY packages/ alongside mcp-host/.
#
# Pinned to Node 24.22.1 by digest for the October 2026 security release.
# HTTP compatibility and native bindings are exercised by the package suite and final-image CI probes.
FROM node:24.22.1-alpine@sha256:06d7adf3e0ef61a13f1d28682726366f97a15aa1888c934d3ecec86c33918b53 AS builder

WORKDIR /app

# Shared prebuilt data-only package (no build step — ships index.cjs + .d.ts).
COPY packages/llm-providers ./packages/llm-providers
COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract
COPY packages/grok-provider-attempt-contract ./packages/grok-provider-attempt-contract
COPY packages/codex-catalog-projection ./packages/codex-catalog-projection
COPY packages/gfs-interaction-policy ./packages/gfs-interaction-policy

# Install dependencies (file: deps resolve to ../packages/llm-providers and
# ../packages/llm-provider-attempt-contract)
COPY mcp-host/package*.json ./mcp-host/
WORKDIR /app/mcp-host
RUN npm ci

# Copy source code
COPY mcp-host/tsconfig.json mcp-host/tsconfig.build.json ./
COPY mcp-host/src ./src

# Build TypeScript
RUN npm run build

# Production image — Debian slim (glibc + apt available)
FROM node:24.22.1-slim@sha256:55fb5f5a527ea2c5c4a95f963e48ef90aa38c7b346054fdc8ee9957a2b55d205

WORKDIR /app

# System tools.
#
# ca-certificates is required, not optional: node:*-slim installs it to fetch
# Node and then purges it, leaving /etc/ssl/certs empty, and
# --no-install-recommends stops apt pulling it back in via git/curl/wget. Drop
# it and every TLS call from a shipped tool fails verification (git "CAfile:
# none", curl exit 000) while mcp-host's own fetch keeps working — Node carries
# its own CA store — so the image looks healthy until an agent uses shell_exec.
# Guarded by scripts/check-dockerfile-ca-certificates.sh.
#
# The font packages are a runtime dependency of the artifact tools, whose own
# face covers Latin, Greek and Cyrillic: DejaVu adds arrows and check marks,
# Noto core adds Arabic and Hebrew, and Noto CJK adds Chinese, Japanese and
# Korean.
RUN apt-get update && apt-get install -y --no-install-recommends \
    bash ca-certificates git curl wget jq \
    fonts-dejavu-core fonts-noto-core fonts-noto-cjk \
    && rm -rf /var/lib/apt/lists/*

# Copy the shared package + package files, install production dependencies only
COPY packages/llm-providers ./packages/llm-providers
COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract
COPY packages/grok-provider-attempt-contract ./packages/grok-provider-attempt-contract
COPY packages/codex-catalog-projection ./packages/codex-catalog-projection
COPY packages/gfs-interaction-policy ./packages/gfs-interaction-policy
COPY mcp-host/package*.json ./mcp-host/
WORKDIR /app/mcp-host
RUN npm ci --only=production

# Copy built code
COPY --from=builder /app/mcp-host/dist ./dist

# Run as non-root user
RUN groupadd -g 1001 nodejs && useradd -u 1001 -g nodejs -m nodejs

# Create writable workspace for native tools (file_read, file_write, shell_exec)
RUN mkdir -p /workspace && chown nodejs:nodejs /workspace

USER nodejs

CMD ["node", "dist/main.js"]