fix(11.3): use COPY (not ADD) in Flask/Redis intro Dockerfile

§7.3 of this book explicitly recommends COPY over ADD for simple
file copies ("在大多数情况下,你应该使用 COPY,而不是 ADD"). The intro
Compose example showed ADD without needing tar extraction or URL
download, contradicting the canonical guidance. Switched to COPY
so the first Dockerfile readers see matches the rule the book
teaches a few chapters later.
This commit is contained in:
yeasy
2026-05-23 21:27:01 -07:00
parent 8f4d88e350
commit 6a55219310
+1 -1
View File
@@ -42,7 +42,7 @@ if __name__ == "__main__":
```docker ```docker
FROM python:3.12-alpine FROM python:3.12-alpine
ADD . /code COPY . /code
WORKDIR /code WORKDIR /code
RUN pip install redis flask RUN pip install redis flask
CMD ["python", "app.py"] CMD ["python", "app.py"]