2016-05-27 15:30:13 -05:00
|
|
|
FROM docker-base
|
2016-03-08 13:42:20 -06:00
|
|
|
|
2016-07-26 14:01:58 -05:00
|
|
|
COPY deps/snmp_*.deb deps/snmpd_*.deb deps/libsnmp-base_*.deb deps/libsnmp30_*.deb /deps/
|
|
|
|
COPY deps/python3/*.whl /python3/
|
2016-03-08 13:42:20 -06:00
|
|
|
|
2016-07-26 14:01:58 -05:00
|
|
|
# enable -O for all Python calls
|
|
|
|
ENV PYTHONOPTIMIZE 1
|
2016-03-08 13:42:20 -06:00
|
|
|
|
2016-07-26 14:01:58 -05:00
|
|
|
## Pre-install the fundamental packages
|
2016-10-25 20:52:13 -05:00
|
|
|
## Install Python SSWSDK (SNMP subagent dependency)
|
2016-03-08 13:42:20 -06:00
|
|
|
## Install SNMP subagent
|
2016-07-26 14:01:58 -05:00
|
|
|
## Note: dpkg_apt function has the benefit to detect missing .deb file
|
2016-05-27 15:30:13 -05:00
|
|
|
## Clean up
|
2016-10-25 20:52:13 -05:00
|
|
|
RUN apt-get update && \
|
|
|
|
dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } && \
|
2016-07-26 14:01:58 -05:00
|
|
|
dpkg_apt /deps/libsnmp-base_*.deb && \
|
|
|
|
dpkg_apt /deps/libsnmp30_*.deb && \
|
|
|
|
dpkg_apt /deps/snmp_*.deb && \
|
2016-10-25 20:52:13 -05:00
|
|
|
dpkg_apt /deps/snmpd_*.deb && \
|
2016-07-26 14:01:58 -05:00
|
|
|
rm -rf /deps
|
|
|
|
|
|
|
|
# install subagent
|
2016-09-09 19:53:41 -05:00
|
|
|
RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
|
2016-07-26 14:01:58 -05:00
|
|
|
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 /python3/*py3*.whl hiredis && \
|
|
|
|
rm -rf /python3 && \
|
2016-10-25 20:52:13 -05:00
|
|
|
python3 -m acs_ax_impl install && \
|
2016-07-26 14:01:58 -05:00
|
|
|
python3 -m pip uninstall -y pip setuptools && \
|
2016-10-25 20:52:13 -05:00
|
|
|
/bin/bash -c "rm -rf /usr/lib/python3.5/{unittest,lib2to3,tkinter,idlelib,email,test}" && \
|
2016-09-09 19:53:41 -05:00
|
|
|
apt-get -y purge build-essential wget libssl-dev openssl && \
|
2016-07-26 14:01:58 -05:00
|
|
|
apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \
|
|
|
|
find / | grep -E "__pycache__" | xargs rm -rf && \
|
2016-09-09 19:53:41 -05:00
|
|
|
rm -rf ~/.cache
|
2016-05-27 15:30:13 -05:00
|
|
|
|
2016-09-09 19:53:41 -05:00
|
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
2016-05-27 15:30:13 -05:00
|
|
|
|
|
|
|
## Although exposing ports is not need for host net mode, keep it for possible bridge mode
|
2016-07-26 14:01:58 -05:00
|
|
|
EXPOSE 161/udp 162/udp
|
2016-05-27 15:30:13 -05:00
|
|
|
|
2016-09-09 19:53:41 -05:00
|
|
|
ENTRYPOINT ["/usr/bin/supervisord"]
|