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} |
| 15 | COPY ./src/ ./bin/ |
| 16 | COPY ./etc/ ./etc/ |
| 17 | |
| 18 | RUN mkdir -p ${APPDIR}/logs \ |
| 19 | && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \ |
| 20 | && chmod a+w ${APPDIR}/logs \ |
| 21 | && chmod 500 ${APPDIR}/etc \ |
| 22 | && chmod 500 ${APPDIR}/bin/dcae_snmptrapd.sh |
| 23 | |
| 24 | |
| 25 | USER ${APPUSER} |
| 26 | |
| 27 | VOLUME ${APPDIR}/logs |
| 28 | |
| 29 | # Run run_policy.sh when the container launches |
| 30 | CMD ["./bin/dcae_snmptrapd.sh"] |