blob: 10886f147bb0b75216dcb1ec15c0f7c3a196ee9f [file] [log] [blame]
alex_sh9d980ce2017-08-23 17:30:56 -04001# Use an official Python runtime as a base image
2FROM python:2.7
3
4ENV INSROOT /opt/app
5ENV APPUSER policy_handler
6ENV APPDIR ${INSROOT}/${APPUSER}
7
8RUN useradd -d ${APPDIR} ${APPUSER}
9
10WORKDIR ${APPDIR}
11
12# Make port 25577 available to the world outside this container
13EXPOSE 25577
14
15# Copy the current directory contents into the container at ${APPDIR}
16COPY ./*.py ./
17COPY ./*.in ./
18COPY ./*.txt ./
19COPY ./*.sh ./
20COPY ./policyhandler/ ./policyhandler/
21COPY ./etc/ ./etc/
22
23RUN mkdir -p ${APPDIR}/logs \
24 && mkdir -p ${APPDIR}/tmp \
25 && mkdir -p ${APPDIR}/etc \
26 && chown -R ${APPUSER}:${APPUSER} ${APPDIR} \
27 && chmod a+w ${APPDIR}/logs \
28 && chmod 700 ${APPDIR}/tmp \
29 && chmod 500 ${APPDIR}/etc \
30 && chmod 500 ${APPDIR}/run_policy.sh \
31 && ls -la && ls -la ./policyhandler
32
33# Install any needed packages specified in requirements.txt
34RUN pip install -r requirements.txt
35
36USER ${APPUSER}
37
38VOLUME ${APPDIR}/logs
39
40# Run run_policy.sh when the container launches
41CMD ["./run_policy.sh"]