[PMSH] Update filter
[dcaegen2/services.git] / components / pm-subscription-handler / Dockerfile
1 # ============LICENSE_START===================================================
2 #  Copyright (C) 2020 Nordix Foundation.
3 #  Copyright 2020 Deutsche Telekom. All rights reserved.
4 # ============================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=====================================================
19
20 FROM nexus3.onap.org:10001/onap/integration-python:8.0.0 as build
21 LABEL maintainer="lego@est.tech"
22
23 USER root
24 RUN set -eux; \
25     apk add \
26     build-base \
27     python3-dev \
28     postgresql-dev
29
30 COPY setup.py ./
31 COPY requirements.txt ./
32 RUN pip install --prefix /opt -r requirements.txt --no-cache-dir
33
34 # Second stage
35 FROM nexus3.onap.org:10001/onap/integration-python:8.0.0
36
37 COPY --from=build /opt /opt
38
39 USER root
40 ARG user=onap
41 ARG group=onap
42
43 # set PATH & PYTHONPATH vars
44 ENV APPDIR="/opt/app/pmsh" \
45     LD_LIBRARY_PATH=/opt/lib \
46     PYTHONPATH=${APPDIR}/mod:/opt/lib/python3.9/site-packages \
47     PATH=$PATH:${APPDIR}/bin \
48     LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \
49     LOGGER_CONFIG="/opt/app/pmsh/log_config.yaml"
50
51 WORKDIR $APPDIR
52 RUN mkdir -p $APPDIR
53
54 RUN set -eux; \
55     apk add --no-cache postgresql-libs
56
57 COPY ./pmsh_service ./bin
58 COPY log_config.yaml ./
59
60 # onap user & group already avaliable, create home dir
61 RUN mkdir -p /home/$user && \
62     chown -R $user:$group /home/$user && \
63     mkdir -p ${LOGS_PATH} && \
64     chown -R $user:$group ${LOGS_PATH} && \
65     chown -R $user:$group ${APPDIR}
66
67 # Tell docker that all future commands should be run as the onap user
68 USER $user
69
70 ENTRYPOINT ["python", "/opt/app/pmsh/bin/pmsh_service_main.py"]