Add stx-snmp docker image

This change reorganizes the source directories of the stx-snmp
container to be reused by both CentOS and Debian Dockerfiles in order
to build the images having the corresponding OS-specic base.

Test plan:

PASS: Debian - Build Debian docker image and upload/apply snmp app
changing the stx-snmp references to point to the new image.
Verified that the app is applied, and the container is created.
PASS: Verified common snmp scenarios:
 - test snmpwalk for 2c and 3 snmp version
 - test snmpget for 2c and 3 snmp version
 - verified traps are working as expected.

PASS: CentOS - Same tests have been done building a CentOS container.

Story: 2009831
Task: 45732

Signed-off-by: Enzo Candotti <enzo.candotti@windriver.com>
Change-Id: I7ecd52c1ad60ab1e82cb50805b71e772e3b93ec4
This commit is contained in:
Enzo Candotti 2022-08-09 00:11:27 -03:00
parent 90a317189a
commit 50919b751a

View File

@ -0,0 +1,22 @@
FROM debian AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update
RUN apt-get -y install\
snmp snmpd snmptrapd \
libsnmp-dev \
gcc \
make \
uuid-dev
RUN ln -s /usr/lib/libuuid.so.1.3.0 /usr/lib/libuuid.so
WORKDIR /home
COPY ./src/* /home/src/
WORKDIR /home/src/
RUN make -f Makefile
FROM builder AS deployment-env
COPY ./mibs/* /usr/share/snmp/mibs/
COPY --from=builder /home/src/libsnmpAuditPlugin.so /usr/lib/
EXPOSE 161/udp
EXPOSE 162/udp
EXPOSE 705/tcp
CMD /usr/sbin/snmpd $OPTIONDEBUG -f