Reduce image size by removing *.pyc + wheels from the image
pmav99 opened this issue · 0 comments
pmav99 commented
You could reduce the image size by removing *.pyc + wheels from the image. E.g. something like this:
# Install ansible + dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
python-setuptools \
python-pip \
software-properties-common \
rsyslog systemd systemd-cron sudo \
# install ansible via pip
&& pip install $pip_packages \
# clean up
&& apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* \
/var/tmp/* \
/usr/share/doc \
/usr/share/man \
# remove python files
&& rm -rf /root/.cache/pip/ \
&& find / -name '*.pyc' -delete \
&& find / -name '*__pycache__*' -delete