Rebuilding an image after a one-line code change should take seconds, not minutes of reinstalling every dependency. Docker caches each step and reuses it until something earlier changes. Use this by copying the dependency manifest and installing packages before copying the rest of the code, plus a .dockerignore. Do not assume a RUN step refetches fresh data, because it is cached by its text, not by what it downloads.