summaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: f3c7ecb8ee0e72b17b01e175d4e7f24d2efa4712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use an official Python runtime as a base image
FROM python:3.6

ENV INSROOT /opt/app
ENV APPUSER snmptrap
ENV APPDIR ${INSROOT}/${APPUSER}

RUN useradd -d ${APPDIR} ${APPUSER}

WORKDIR ${APPDIR}

EXPOSE 162:162/udp

# Copy the current directory contents into the container at ${APPDIR}
COPY ./snmptrap/ ./bin/
COPY ./etc/ ./etc/
COPY requirements.txt ./
RUN pip install -r requirements.txt

RUN mkdir -p ${APPDIR}/data \
 && mkdir -p ${APPDIR}/logs \
 && mkdir -p ${APPDIR}/tmp \
 && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \
 && chmod a+w ${APPDIR}/data \
 && chmod a+w ${APPDIR}/logs \
 && chmod a+w ${APPDIR}/tmp \
 && chmod 500 ${APPDIR}/etc \
 && chmod 500 ${APPDIR}/bin/snmptrapd.sh 

USER ${APPUSER}

VOLUME ${APPDIR}/logs

# Run run_policy.sh when the container launches
CMD ["./bin/snmptrapd.sh", "start"]