30134c8a4da5fb2170e5f5d23e514f6715bf61dd
[dcaegen2/platform.git] / oti / event-handler / Dockerfile
1 # ================================================================================
2 # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # ============LICENSE_END=========================================================
16 #
17
18 FROM python:3.6
19
20 ENV INSROOT /opt/app
21 ENV APPUSER oti_handler
22 ENV HOME ${INSROOT}/${APPUSER}
23
24 RUN useradd -d ${HOME} ${APPUSER}
25
26 WORKDIR ${HOME}
27
28 EXPOSE 9443
29
30 COPY ./*.py ./
31 COPY ./*.in ./
32 COPY ./*.txt ./
33 COPY ./*.sh ./
34 COPY ./otihandler/ ./otihandler/
35 COPY ./etc/ ./etc/
36 COPY create_schema.sql /tmp/create_schema.sql
37
38 RUN mkdir -p ${HOME}/logs \
39  && chown -R ${APPUSER}:${APPUSER} ${HOME} \
40  && chmod 500 ${HOME}/etc \
41  && chmod 500 ${HOME}/*.sh \
42  && sleep 5 \
43  && pip install -r requirements.txt
44
45 RUN apt-get update \
46  && apt-get -y --allow-unauthenticated install vim-tiny \
47  && apt-get -y --allow-unauthenticated install dos2unix \
48  && apt-get -y --allow-unauthenticated install postgresql \
49  && dos2unix /tmp/create_schema.sql \
50  && dos2unix run.sh \
51  && chmod 777 /tmp/create_schema.sql
52
53 USER ${APPUSER}
54
55 RUN ls -lanR ${HOME}
56
57 ENTRYPOINT ["./run.sh"]