From 4a0872bec05348e67eb2161a8e8ab993231eb5c9 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Fri, 15 Nov 2024 03:19:48 +0800 Subject: [PATCH] Clean up cache files to reduce Docker image size Remove unnecessary cache files and temporary data: - Remove apt lists after package installation - Use pip --no-cache-dir flag Image size comparison: ``` REPOSITORY TAG IMAGE ID CREATED SIZE scrapegraph-ai after 609a2ecf4678 20 minutes ago 3.1GB scrapegraph-ai before e3093b782ab0 24 minutes ago 3.39GB ``` This reduced about 0.29GB image size by preventing cache files from being included in the final image layers. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a04c8551..a5f71732 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM python:3.11-slim -RUN apt-get update && apt-get upgrade -y +RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* -RUN pip install scrapegraphai -RUN pip install scrapegraphai[burr] +RUN pip install --no-cache-dir scrapegraphai +RUN pip install --no-cache-dir scrapegraphai[burr] RUN python3 -m playwright install-deps RUN python3 -m playwright install \ No newline at end of file