blob: f3c7ecb8ee0e72b17b01e175d4e7f24d2efa4712 [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
Ladue, David (dl3158)e0b9a692018-03-22 17:32:07 -040012EXPOSE 162:162/udp
vagrant00bd7aa2018-01-20 15:12:44 +000013
14# Copy the current directory contents into the container at ${APPDIR}
Vijay VK339ca1c2018-03-27 02:05:36 +010015COPY ./snmptrap/ ./bin/
vagrant00bd7aa2018-01-20 15:12:44 +000016COPY ./etc/ ./etc/
Ladue, David (dl3158)5f904e62018-03-20 16:55:35 -040017COPY requirements.txt ./
18RUN pip install -r requirements.txt
vagrant00bd7aa2018-01-20 15:12:44 +000019
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040020RUN mkdir -p ${APPDIR}/data \
21 && mkdir -p ${APPDIR}/logs \
22 && mkdir -p ${APPDIR}/tmp \
vagrant00bd7aa2018-01-20 15:12:44 +000023 && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040024 && chmod a+w ${APPDIR}/data \
vagrant00bd7aa2018-01-20 15:12:44 +000025 && chmod a+w ${APPDIR}/logs \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040026 && chmod a+w ${APPDIR}/tmp \
vagrant00bd7aa2018-01-20 15:12:44 +000027 && chmod 500 ${APPDIR}/etc \
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040028 && chmod 500 ${APPDIR}/bin/snmptrapd.sh
Ladue, David (dl3158)93dcd542018-03-20 10:18:46 -040029
vagrant00bd7aa2018-01-20 15:12:44 +000030USER ${APPUSER}
31
32VOLUME ${APPDIR}/logs
33
34# Run run_policy.sh when the container launches
Lusheng Ji4986bf02018-04-22 16:58:43 -040035CMD ["./bin/snmptrapd.sh", "start"]