Docker Cursor Rules
Cursor rules for Docker: multi-stage builds, security hardening, layer optimization, and production-ready Dockerfile conventions.
- Use official minimal base images (alpine, distroless, slim variants) - Always use multi-stage builds to keep production images small and secure - Never run containers as root; add USER directive with a non-root user - Pin base image versions with digest (FROM node:20-alpine@sha256:...) - Combine RUN commands to minimize layers; clean package manager cache - Use .dockerignore to exclude node_modules, .git, secrets, and build artifacts - Never bake secrets into images; use build args only for non-sensitive build config - Set HEALTHCHECK instructions for production services
How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
Related Rules
Python Cursor Rules
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
TypeScript Cursor Rules
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
React Cursor Rules
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Next.js Cursor Rules
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.