blob: 9e3ebfe8f29b37b5c4bd9efb4cd6d25bd684fee3 [file] [log] [blame]
efiacor9b532682019-11-06 11:08:54 +00001# ============LICENSE_START===================================================
efiacor8b3fc622020-01-24 13:19:01 +00002# Copyright (C) 2020 Nordix Foundation.
Michal Jagiello2d223b12020-08-13 08:28:45 +00003# Copyright 2020 Deutsche Telekom. All rights reserved.
efiacor9b532682019-11-06 11:08:54 +00004# ============================================================================
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
Alexander Mazuruk835ad812021-04-12 18:48:00 +020020FROM nexus3.onap.org:10001/onap/integration-python:8.0.0 as build
21LABEL maintainer="lego@est.tech"
efiacor9b532682019-11-06 11:08:54 +000022
Alexander Mazuruk835ad812021-04-12 18:48:00 +020023USER root
efiacore783ede2020-08-28 14:00:14 +010024RUN set -eux; \
25 apk add \
26 build-base \
27 python3-dev \
28 postgresql-dev
29
30COPY setup.py ./
31COPY requirements.txt ./
32RUN pip install --prefix /opt -r requirements.txt --no-cache-dir
33
34# Second stage
Alexander Mazuruk835ad812021-04-12 18:48:00 +020035FROM nexus3.onap.org:10001/onap/integration-python:8.0.0
efiacore783ede2020-08-28 14:00:14 +010036
37COPY --from=build /opt /opt
38
Alexander Mazuruk835ad812021-04-12 18:48:00 +020039USER root
Michal Jagiello2d223b12020-08-13 08:28:45 +000040ARG user=onap
41ARG group=onap
42
Michal Jagiello2d223b12020-08-13 08:28:45 +000043# set PATH & PYTHONPATH vars
efiacore783ede2020-08-28 14:00:14 +010044ENV APPDIR="/opt/app/pmsh" \
Alexander Mazuruk835ad812021-04-12 18:48:00 +020045 LD_LIBRARY_PATH=/opt/lib \
46 PYTHONPATH=${APPDIR}/mod:/opt/lib/python3.9/site-packages \
efiacore783ede2020-08-28 14:00:14 +010047 PATH=$PATH:${APPDIR}/bin \
ERIMROB27605192020-05-12 12:56:56 +010048 LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \
efiacore783ede2020-08-28 14:00:14 +010049 LOGGER_CONFIG="/opt/app/pmsh/log_config.yaml"
efiacor9b532682019-11-06 11:08:54 +000050
efiacore783ede2020-08-28 14:00:14 +010051WORKDIR $APPDIR
52RUN mkdir -p $APPDIR
efiacor9b532682019-11-06 11:08:54 +000053
efiacore783ede2020-08-28 14:00:14 +010054RUN set -eux; \
Alexander Mazuruk835ad812021-04-12 18:48:00 +020055 apk add --no-cache postgresql-libs
efiacor9b532682019-11-06 11:08:54 +000056
efiacore783ede2020-08-28 14:00:14 +010057COPY ./pmsh_service ./bin
58COPY log_config.yaml ./
efiacor9b532682019-11-06 11:08:54 +000059
Alexander Mazuruk835ad812021-04-12 18:48:00 +020060# onap user & group already avaliable, create home dir
61RUN mkdir -p /home/$user && \
62 chown -R $user:$group /home/$user && \
efiacore783ede2020-08-28 14:00:14 +010063 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
68USER $user
69
Alexander Mazuruk835ad812021-04-12 18:48:00 +020070ENTRYPOINT ["python", "/opt/app/pmsh/bin/pmsh_service_main.py"]