Establish comprehensive quality infrastructure for a project that previously had zero tests, enabling confident refactoring and community contributions with automated guardrails. Port upstream enhancements for font normalization, image element support, and arrow binding preservation. 🏗️ Testing infrastructure: - Unit tests for SQLite persistence layer and element validation helpers - Integration tests for REST API, WebSocket broadcast, and arrow binding - E2E tests with Playwright for canvas rendering and real-time sync - Vitest + Playwright configuration with proper isolation 👷 CI/CD pipeline: - Auto-versioning from conventional commits on push to main - Auto-publish to NPM and Docker Hub on GitHub release - Matrix testing across Node 18/20/22 with pinned dependencies - Docker health check with diagnostic logging on failure - Preserve rollup status checks for branch protection gates 📦 Developer experience: - Interactive setup wizard for first-time configuration - Canvas clear confirmation and scene description tools - Frontend helpers extracted for testability 🔧 Upstream feature ports: - Font family normalization (string names to numeric IDs) - Image element support with file management API - Arrow binding preservation through server round-trips - Vite config fix for font subsetting worker chunk names - Idempotent database initialization for standalone Docker mode 🐛 Docker fixes: - Set EXCALIDRAW_DB_PATH in both Dockerfiles to writable /app/data/ - Make initDb() idempotent and closeDb() reset-safe for test isolation 🎯 Provides the safety net needed for rapid iteration — every PR is validated across 120 test cases before merge, and releases are fully automated from commit to published package. Co-authored-by: sanjibdevnathlabs <devnath.sanjib@gmail.com>
64 lines
1.7 KiB
Docker
64 lines
1.7 KiB
Docker
# Dockerfile for Canvas Server (Optional)
|
|
# Provides the web interface, REST API, and SQLite persistence
|
|
|
|
# Stage 1: Build frontend
|
|
FROM node:18-slim AS frontend-builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts
|
|
|
|
COPY frontend ./frontend
|
|
COPY vite.config.js ./
|
|
RUN npm run build:frontend
|
|
|
|
# Stage 2: Build backend (TypeScript compilation + native modules)
|
|
FROM node:18-slim AS backend-builder
|
|
|
|
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
|
|
|
|
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 3: Production Canvas Server
|
|
FROM node:18-slim AS production
|
|
|
|
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 --gid 1001 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 apt-get purge -y python3 make g++ && apt-get autoremove -y
|
|
|
|
COPY --from=backend-builder /app/dist ./dist
|
|
COPY --from=frontend-builder /app/dist/frontend ./dist/frontend
|
|
|
|
RUN mkdir -p /app/data && chown -R nodejs:nodejs /app
|
|
USER nodejs
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
ENV EXCALIDRAW_DB_PATH=/app/data/excalidraw.db
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "dist/server.js"]
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/sanjibdevnathlabs/mcp-excalidraw-local"
|
|
LABEL org.opencontainers.image.description="MCP Excalidraw Canvas Server - Web UI and REST API (with SQLite persistence & multi-tenancy)"
|
|
LABEL org.opencontainers.image.licenses="MIT"
|