dockerfile-builder
为后端生成完整的生产级Dockerfile,包含多阶段构建、适当的依赖项和Hugging Face Spaces兼容性。
📖 中文导读:为后端生成完整的生产级Dockerfile,包含多阶段构建、适当的依赖项和Hugging Face Spaces兼容性。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Dockerfile Builder description: Generate the full production Dockerfile for the backend with multi-stage build, proper dependencies, and Hugging Face Spaces compatibility.
Dockerfile Builder
Instructions
Generate production Dockerfile with multi-stage build:
- Use Python slim base image
- Install FastAPI, Uvicorn, Qdrant client, Agent SDK dependencies
- Copy application code efficiently
- Set up proper working directory
Configure for Hugging Face Spaces compatibility:
- Expose port 7860 as required
- Set proper user permissions
- Include health check if needed
- Optimize image size for deployment
Implement multi-stage build pattern:
- Build stage for dependencies
- Final stage with minimal runtime
- Copy only necessary files
- Clean up build artifacts
Add proper runtime configuration:
- Set environment variables
- Configure startup command
- Add non-root user if security required
- Include proper signal handling
Follow Context7 MCP standards:
- Ensure compatibility with Hugging Face Spaces Docker mode
- Follow deterministic build patterns
- Include proper error handling
- Document all configuration options
Examples
Input: "Create Dockerfile for Hugging Face Spaces deployment" Output: Creates Dockerfile with multi-stage build that's compatible with Hugging Face Spaces.