Skip to content

Commit 6d21c29

Browse files
authored
control-service: optimize job builder pip install (#3151)
Pip caching is never useful for Docker builds, and it makes the image bigger and cause the process to consume more memory which can lead to OOM errors.
1 parent da4444e commit 6d21c29

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

projects/control-service/projects/job-builder-rootless/Dockerfile.python.vdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY --chown=$UID:$GID $job_name $job_name/
2121
# TODO: this would trigger for any change in job even if requirements.txt does not change
2222
# but there's no COPY_IF_EXISTS command in docker to try copy it.
2323
ARG requirements_file=requirements.txt
24-
RUN if [ -f "$job_name/$requirements_file" ]; then pip3 install --disable-pip-version-check -q -r "$job_name/$requirements_file" || ( echo ">requirements_failed<" && exit 1 ) ; fi
24+
RUN if [ -f "$job_name/$requirements_file" ]; then pip3 install --no-cache-dir --disable-pip-version-check -q -r "$job_name/$requirements_file" || ( echo ">requirements_failed<" && exit 1 ) ; fi
2525

2626
ARG job_githash
2727
ENV JOB_NAME $job_name

projects/control-service/projects/job-builder-secure/Dockerfile.python.vdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RUN : \
4949
echo "Installing native dependencies ..." \
5050
&& yum install build-essential gcc glibc-devel git freetype2-devel libpng-devel -y \
5151
&& echo "Installing requirements.txt ..." \
52-
&& pip install --disable-pip-version-check -q -r "$job_name/$requirements_file" \
52+
&& pip install --no-cache-dir --disable-pip-version-check -q -r "$job_name/$requirements_file" \
5353
|| ( echo ">requirements_failed<" && exit 1 ) \
5454
&& echo "Removing native dependencies ..." \
5555
&& yum autoremove build-essential gcc glibc-devel git unzip -y \

projects/control-service/projects/job-builder/Dockerfile.python.vdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY --chown=$UID:$GID $job_name $job_name/
2121
# TODO: this would trigger for any change in job even if requirements.txt does not change
2222
# but there's no COPY_IF_EXISTS command in docker to try copy it.
2323
ARG requirements_file=requirements.txt
24-
RUN if [ -f "$job_name/$requirements_file" ]; then pip3 install --disable-pip-version-check -q -r "$job_name/$requirements_file" || ( echo ">requirements_failed<" && exit 1 ) ; fi
24+
RUN if [ -f "$job_name/$requirements_file" ]; then pip3 install --no-cache-dir --disable-pip-version-check -q -r "$job_name/$requirements_file" || ( echo ">requirements_failed<" && exit 1 ) ; fi
2525

2626
ARG job_githash
2727
ENV JOB_NAME $job_name

0 commit comments

Comments
 (0)