Skip to content

Commit 8a92ecf

Browse files
authored
chore : use --no-cache-dir flag to pip in dockerfiles to save space (#47)
using --no-cache-dir flag in pip install ,make sure downloaded packages by pip don't cached on system . This is a best practice which make sure to fetch from repo instead of using local cached one . Further , in case of Docker Containers , by restricting caching , we can reduce image size. In term of stats , it depends upon the number of python packages multiplied by their respective size . e.g for heavy packages with a lot of dependencies it reduce a lot by don't caching pip packages. Further , more detail information can be found at https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6 Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
1 parent b29193a commit 8a92ecf

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

.github/docker-performance-tests/alarms-poller/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3.9
22

33
COPY . .
44

5-
RUN pip install docker boto3
5+
RUN pip install --no-cache-dir docker boto3
66

77
CMD python ./poll_during_performance_tests.py --logs-namespace $LOGS_NAMESPACE \
88
--metrics-period $HOSTMETRICS_INTERVAL_SECS \

integration-test-apps/auto-instrumentation/flask/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
COPY . .
66

7-
RUN pip install -r requirements.txt
7+
RUN pip install --no-cache-dir -r requirements.txt
88

99
RUN opentelemetry-bootstrap --action=install
1010

integration-test-apps/manual-instrumentation/flask/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
COPY . .
66

7-
RUN pip install -r requirements.txt
7+
RUN pip install --no-cache-dir -r requirements.txt
88

99
ENV HOME=/
1010

integration-test-apps/none-instrumentation/flask/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
COPY . .
66

7-
RUN pip install -r requirements.txt
7+
RUN pip install --no-cache-dir -r requirements.txt
88

99
ENV HOME=/
1010

0 commit comments

Comments
 (0)