Skip to content

Commit 4ef94c8

Browse files
xuhdevnejch
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 c53e695 commit 4ef94c8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dockerfile

+3-3
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)