blob: c8c8ae5175ab805e3f72396b627f1bfd46e5279b [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/
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
Ladue, David (dl3158)fb0aff82018-03-18 23:16:42 -040035CMD ["./bin/snmptrapd.sh start"]