# Dockerfile for MCP Excalidraw Server # Builds the MCP server with SQLite persistence # Stage 1: Build backend (TypeScript compilation + native modules) FROM node:20-alpine AS builder RUN apk add --no-cache python3 make g++ WORKDIR /app COPY package*.json ./ RUN --mount=type=cache,target=/root/.npm npm ci COPY src ./src COPY tsconfig.json ./ RUN npm run build:server # Stage 2: Production MCP Server FROM node:20-alpine AS production RUN apk add --no-cache python3 make g++ RUN addgroup -S -g 1001 nodejs && \ adduser -S -u 1001 -G nodejs nodejs WORKDIR /app COPY package*.json ./ RUN --mount=type=cache,target=/root/.npm npm ci --omit=dev # Remove build tools after native modules are compiled RUN apk del python3 make g++ COPY --from=builder /app/dist ./dist RUN mkdir -p /app/data && chown -R nodejs:nodejs /app USER nodejs ENV NODE_ENV=production ENV EXPRESS_SERVER_URL=http://localhost:3000 ENV ENABLE_CANVAS_SYNC=true ENV EXCALIDRAW_DB_PATH=/app/data/excalidraw.db CMD ["node", "dist/index.js"] LABEL org.opencontainers.image.source="https://github.com/celstnblacc/excalidraw-mcp-sentinel" LABEL org.opencontainers.image.description="MCP Excalidraw Server - Model Context Protocol for AI agents (with SQLite persistence & multi-tenancy)" LABEL org.opencontainers.image.licenses="MIT"