Skip to content

Commit

Permalink
Prevent leaving pip install cache in Docker iamge (#7544)
Browse files Browse the repository at this point in the history
* Prevent leaving pip install cache in Docker iamge

Use `--no-cache-dir` with `pip install` in Dockerfile to prevent cache
and minimize the Docker image.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
PeterDaveHello and Pierre-Sassoulas committed Oct 1, 2022
1 parent 644f3fd commit 2a0a7ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM python:3.10.0-alpine3.15

COPY ./ /tmp/build
WORKDIR /tmp/build
RUN python -m pip install . && rm -rf /tmp/build
RUN python -m pip install --no-cache-dir . && rm -rf /tmp/build

ENTRYPOINT ["pylint"]
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7544.other
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Prevent leaving the pip install cache in the Docker image.

Refs #7544

0 comments on commit 2a0a7ee

Please sign in to comment.