Create optimized Docker images using multi-stage builds to reduce image size and improve security.
I need help creating an optimized Dockerfile using multi-stage builds for my application. Application details: - Language/Framework: [e.g., Node.js, Python, Go, Java] - Build requirements: [e.g., npm install, pip install, go build] - Runtime dependencies: [list runtime-only dependencies] - Current image size: [if known] - Target image size: [desired size] Please create a multi-stage Dockerfile that: 1. Uses appropriate base images for build and runtime stages 2. Minimizes the final image size 3. Follows security best practices (non-root user, minimal packages) 4. Properly handles caching for faster builds 5. Includes health checks 6. Documents each stage with comments Also explain the size reduction achieved and any trade-offs made.
Or press ⌘C to copy