Back to questionsYou edit only
JuniorTheoryVery common
You edit only app.py and rebuild; from which step does Docker stop using the cache?
FROM python:3.13-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]From COPY . . on: every step above it comes from the cache
- Expecting any changed file to rerun
pip install— it reruns only when a step above it misses the cache - Thinking the cache compares only instruction text, so a changed file never rebuilds a
COPY
- Why does copying the whole project before
pip installslow every build down? - What does
docker build --no-cachechange?