From f5e24bdf1ae10e3c7d41dca314f27cd66006bbaa Mon Sep 17 00:00:00 2001 From: Bogdan Radulescu Date: Wed, 18 Jun 2025 07:50:46 +0300 Subject: [PATCH] Optimize the Docker image size --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index d7de72f01..a7caa88b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -121,6 +121,10 @@ RUN if [ "$USE_OLLAMA" = "true" ]; then \ curl -fsSL https://ollama.com/install.sh | sh && \ # cleanup rm -rf /var/lib/apt/lists/*; \ + # We make python smaller + find /usr/local/ -name "*.pyc" -delete \ + find /usr/local/ -name "*.so" -exec strip {} + \ + find /usr/local/ -type d \( -name test -o -name tests -o -name __pycache__ -o -name include \) -exec rm -rf '{}' + \ else \ apt-get update && \ # Install pandoc, netcat and gcc @@ -130,6 +134,10 @@ RUN if [ "$USE_OLLAMA" = "true" ]; then \ apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \ # cleanup rm -rf /var/lib/apt/lists/*; \ + # We make python smaller + find /usr/local/ -name "*.pyc" -delete \ + find /usr/local/ -name "*.so" -exec strip {} + \ + find /usr/local/ -type d \( -name test -o -name tests -o -name __pycache__ -o -name include \) -exec rm -rf '{}' + \ fi # install python dependencies