Write a `.dockerignore` for a typical Node or Python project and explain why it matters.
BeginnerHands-onWrite-a-Dockerfile tasks
Answer
.git
.gitignore
node_modules
__pycache__/
*.pyc
.venv/
.env
*.log
coverage/
dist/
Dockerfile*
docker-compose*.yml
.github/
Key trick → It shrinks the build context (faster builds), stops local node_modules overwriting the in-image install, and keeps .env secrets and .git history out of the image.
More on Write-a-Dockerfile tasks
Write a production Dockerfile for a Node.js API using a multi-stage build.IntermediateWrite a Dockerfile for a Python Flask app that runs with gunicorn as a non-root user.BeginnerWrite a Dockerfile for a Go service that produces a tiny image (under 20 MB).IntermediateWrite a multi-stage Dockerfile for a Java Spring Boot app built with Maven.IntermediateWrite a Dockerfile for a static React site served by Nginx.BeginnerThis Dockerfile rebuilds dependencies on every code change. Fix it.Beginner