Dockerfile.mcp-bookstack•981 B
FROM node:20-alpine
WORKDIR /app
# Install system dependencies
RUN apk add --no-cache git curl wget
# Clone the repository (self-contained approach)
RUN git clone https://github.com/ttpears/bookstack-mcp.git .
# Install dependencies and build
RUN npm install && npm run build
# Remove dev dependencies and clean cache
RUN npm ci --omit=dev && npm cache clean --force
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Change ownership of the app directory
RUN chown -R nodejs:nodejs /app
USER nodejs
# Expose port for supergateway
EXPOSE 8007
# Set default port
ENV PORT=8007
# Health check for container orchestration
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8007/health || exit 1
# Use supergateway to bridge stdio MCP server to HTTP/SSE
CMD ["npx", "-y", "supergateway", "--stdio", "node dist/stdio.js", "--port", "8007"]