sonic-buildimage/dockers/docker-snmp-sv2/Dockerfile.j2

58 lines
2.1 KiB
Django/Jinja

FROM docker-base
COPY \
{% for deb in docker_snmp_sv2_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/
COPY python-wheels /python-wheels
# enable -O for all Python calls
ENV PYTHONOPTIMIZE 1
## Pre-install the fundamental packages
## Install Python SSWSDK (SNMP subagent dependency)
## Install SNMP subagent
## Clean up
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev
# Dependencies for sonic-cfggen
RUN apt-get install -y python-lxml python-jinja2 python-netaddr python-ipaddr python-yaml
RUN dpkg -i \
{% for deb in docker_snmp_sv2_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}
RUN rm -rf /debs
# install subagent
RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
rm -rf /var/lib/apt/lists/* && \
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz && \
tar xvf Python-3.5.2.tgz && cd Python-3.5.2 && \
./configure --without-doc-strings --prefix=/usr --without-pymalloc --enable-shared && \
make && make install && \
ldconfig && \
cd .. && rm -rf Python-3.5.2 && rm Python-3.5.2.tgz && \
pip3 install --no-cache-dir /python-wheels/*py3*.whl hiredis && \
rm -rf /python-wheels && \
python3 -m sonic_ax_impl install && \
python3 -m pip uninstall -y pip setuptools && \
/bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \
apt-get -y purge build-essential libssl-dev openssl && \
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \
find / | grep -E "__pycache__" | xargs rm -rf && \
rm -rf ~/.cache
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ["*.j2", "/etc/swss/snmp/"]
COPY ["snmpd", "/etc/default/"]
COPY ["config.sh", "/usr/bin/"]
## Although exposing ports is not need for host net mode, keep it for possible bridge mode
EXPOSE 161/udp 162/udp
ENTRYPOINT /usr/bin/config.sh && /usr/bin/supervisord