gns3-registry/docker/network_automation_pycharm/Dockerfile
Pratik Raj 707f96e501 chore : use --no-cache-dir flag to pip in dockerfiles to save space
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>
2021-09-22 15:26:14 +05:30

57 lines
1.6 KiB
Docker

FROM phusion/baseimage:0.9.22
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Tell debconf to run in non-interactive mode
ENV DEBIAN_FRONTEND noninteractive
ENV PYCHARM_HOME=/etc/pycharm
RUN apt-get update && apt-get -y --no-install-recommends install \
wget \
git \
openjdk-9-jre \
libxrender1 \
libxtst6 \
python \
python3 \
curl \
openssh-client \
nano \
vim \
iputils-ping \
python \
build-essential \
libssl-dev \
libffi-dev \
python-pip \
python-setuptools \
python3-setuptools \
python-dev \
net-tools \
telnet \
software-properties-common \
&& apt-add-repository -y ppa:ansible/ansible \
&& apt-get update && apt-get -y --no-install-recommends install ansible \
&& pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir cryptography netmiko napalm pyntc \
&& pip install --no-cache-dir --upgrade paramiko \
&& pip install --no-cache-dir pexpect \
&& pip install --no-cache-dir docopt==0.6.2 sh
RUN export JAVA_HOME=/usr/lib/jvm/default-java
RUN wget https://download.jetbrains.com/python/pycharm-community-2017.2.3.tar.gz
RUN mkdir ${PYCHARM_HOME} && tar -xzvf pycharm-community-2017.2.3.tar.gz -C ${PYCHARM_HOME} --strip=1 &&\
wget -P /tmp/ https://bootstrap.pypa.io/get-pip.py && python /tmp/get-pip.py &&\
rm -rf /var/lib/apt-lists; rm -rf /tmp/*; apt-get purge wget -y; apt-get autoremove -y
RUN mkdir /scripts
RUN mkdir /etc/sv/pycharm
ADD pycharm-run /etc/sv/pycharm/run
RUN chmod a+x /etc/sv/pycharm/run
RUN ln -s /etc/sv/pycharm /etc/service
VOLUME ["/root", "/usr/", "/scripts"]