Optimize the Docker image size

This commit is contained in:
Bogdan Radulescu 2025-06-18 07:50:46 +03:00
parent 3b70841a7d
commit f5e24bdf1a

View File

@ -121,6 +121,10 @@ RUN if [ "$USE_OLLAMA" = "true" ]; then \
curl -fsSL https://ollama.com/install.sh | sh && \ curl -fsSL https://ollama.com/install.sh | sh && \
# cleanup # cleanup
rm -rf /var/lib/apt/lists/*; \ 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 \ else \
apt-get update && \ apt-get update && \
# Install pandoc, netcat and gcc # 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 && \ apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
# cleanup # cleanup
rm -rf /var/lib/apt/lists/*; \ 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 fi
# install python dependencies # install python dependencies