8000 build: Add "--no-cache-dir" to pip commands in Dockerfile · python-gitlab/python-gitlab@d9310a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9310a7

Browse files
xuhdevCristiano Casella
authored andcommitted
build: Add "--no-cache-dir" to pip commands in Dockerfile
This would not leave cache files in the built docker image. Additionally, also only build the wheel in the build phase. On my machine, before this PR, size is 74845395; after this PR, size is 72617713.
1 parent ad1fe50 commit d9310a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ FROM python:3.12-${PYTHON_FLAVOR} AS build
33

44
WORKDIR /opt/python-gitlab
55
COPY . .
6-
RUN pip install build && python -m build
6+
RUN pip install --no-cache-dir build && python -m build --wheel
77

88
FROM python:3.12-${PYTHON_FLAVOR}
99

1010
LABEL org.opencontainers.image.source="https://github.com/python-gitlab/python-gitlab"
1111

1212
WORKDIR /opt/python-gitlab
1313
COPY --from=build /opt/python-gitlab/dist dist/
14-
RUN pip install PyYaml
15-
RUN pip install $(find dist -name *.whl) && \
14+
RUN pip install --no-cache-dir PyYaml
15+
RUN pip install --no-cache-dir $(find dist -name *.whl) && \
1616
rm -rf dist/
1717

1818
ENTRYPOINT ["gitlab"]

0 commit comments

Comments
 (0)
0