vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 1 | # Use an official Python runtime as a base image |
| 2 | FROM python:3.6 |
| 3 | |
| 4 | ENV INSROOT /opt/app |
| 5 | ENV APPUSER snmptrap |
| 6 | ENV APPDIR ${INSROOT}/${APPUSER} |
| 7 | |
| 8 | RUN useradd -d ${APPDIR} ${APPUSER} |
| 9 | |
| 10 | WORKDIR ${APPDIR} |
| 11 | |
| 12 | EXPOSE 162 |
| 13 | |
| 14 | # Copy the current directory contents into the container at ${APPDIR} |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 15 | COPY ./bin/ ./bin/ |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 16 | COPY ./etc/ ./etc/ |
Ladue, David (dl3158) | 5f904e6 | 2018-03-20 16:55:35 -0400 | [diff] [blame] | 17 | COPY requirements.txt ./ |
| 18 | RUN pip install -r requirements.txt |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 19 | |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 20 | RUN mkdir -p ${APPDIR}/data \ |
| 21 | && mkdir -p ${APPDIR}/logs \ |
| 22 | && mkdir -p ${APPDIR}/tmp \ |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 23 | && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \ |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 24 | && chmod a+w ${APPDIR}/data \ |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 25 | && chmod a+w ${APPDIR}/logs \ |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 26 | && chmod a+w ${APPDIR}/tmp \ |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 27 | && chmod 500 ${APPDIR}/etc \ |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 28 | && chmod 500 ${APPDIR}/bin/snmptrapd.sh |
Ladue, David (dl3158) | 93dcd54 | 2018-03-20 10:18:46 -0400 | [diff] [blame] | 29 | |
vagrant | 00bd7aa | 2018-01-20 15:12:44 +0000 | [diff] [blame] | 30 | USER ${APPUSER} |
| 31 | |
| 32 | VOLUME ${APPDIR}/logs |
| 33 | |
| 34 | # Run run_policy.sh when the container launches |
Ladue, David (dl3158) | fb0aff8 | 2018-03-18 23:16:42 -0400 | [diff] [blame] | 35 | CMD ["./bin/snmptrapd.sh start"] |