What problem does it solve?
This Skill resolves the common Docker multi-stage build issue where the COPY . . instruction overwrites freshly built dist/ files in the container with stale dist/ files from the host machine, caused by a missing .dockerignore file. This results in outdated code being packaged into Docker images even after successful local rebuilds, with no visible changes when running the container.
Core Features & Use Cases
- Root Cause Explanation: Clearly details why missing .dockerignore files lead to stale dist/ overwrites, and why common workarounds like docker build --no-cache fail to resolve the issue.
- Precise Fix Configuration: Provides the exact .dockerignore content to exclude dist/, node_modules, and other unnecessary files from the Docker build context.
- Verification Guidance: Includes step-by-step commands to confirm the built Docker image contains the latest code, and outlines common pitfalls to avoid.
- Use Case: Ideal for frontend and backend developers using Docker multi-stage builds for Node.js, Vite, React, or similar projects who are seeing inconsistent or outdated code in their deployed containers.
Quick Start
Use the docker-multi-stage-dist-overwrite skill to fix stale dist/ overwrite issues in your Docker multi-stage builds by adding the required .dockerignore file to your project root.