blob: b1229b28ccfa615b21f0421b80423a27722d64b8 [file] [log] [blame]
vagrant00bd7aa2018-01-20 15:12:44 +00001# Use an official Python runtime as a base image
2FROM python:3.6
3
4ENV INSROOT /opt/app
5ENV APPUSER snmptrap
6ENV APPDIR ${INSROOT}/${APPUSER}
7
8RUN useradd -d ${APPDIR} ${APPUSER}
9
10WORKDIR ${APPDIR}
11
12EXPOSE 162
13
14# Copy the current directory contents into the container at ${APPDIR}
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040015COPY ./bin/ ./bin/
vagrant00bd7aa2018-01-20 15:12:44 +000016COPY ./etc/ ./etc/
17
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040018RUN mkdir -p ${APPDIR}/data \
19 && mkdir -p ${APPDIR}/logs \
20 && mkdir -p ${APPDIR}/tmp \
vagrant00bd7aa2018-01-20 15:12:44 +000021 && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040022 && chmod a+w ${APPDIR}/data \
vagrant00bd7aa2018-01-20 15:12:44 +000023 && chmod a+w ${APPDIR}/logs \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040024 && chmod a+w ${APPDIR}/tmp \
vagrant00bd7aa2018-01-20 15:12:44 +000025 && chmod 500 ${APPDIR}/etc \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040026 && chmod 500 ${APPDIR}/bin/snmptrapd.sh
Ladue, David (dl3158)93dcd542018-03-20 10:18:46 -040027
28RUN python setup.py install
vagrant00bd7aa2018-01-20 15:12:44 +000029
30USER ${APPUSER}
31
32VOLUME ${APPDIR}/logs
33
34# Run run_policy.sh when the container launches
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040035CMD ["./bin/snmptrapd.sh start"]