blob: 4ac915e0fafac2cd4cc2f074dc63d19d2ea89138 [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
vagrant00bd7aa2018-01-20 15:12:44 +000027
28
29USER ${APPUSER}
30
31VOLUME ${APPDIR}/logs
32
33# Run run_policy.sh when the container launches
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040034CMD ["./bin/snmptrapd.sh start"]