efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 1 | # ============LICENSE_START=================================================== |
efiacor | 8b3fc62 | 2020-01-24 13:19:01 +0000 | [diff] [blame] | 2 | # Copyright (C) 2020 Nordix Foundation. |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame] | 3 | # Copyright 2020 Deutsche Telekom. All rights reserved. |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 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 | |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 20 | FROM nexus3.onap.org:10001/onap/integration-python:8.0.0 as build |
| 21 | LABEL maintainer="lego@est.tech" |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 22 | |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 23 | USER root |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 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 |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 35 | FROM nexus3.onap.org:10001/onap/integration-python:8.0.0 |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 36 | |
| 37 | COPY --from=build /opt /opt |
| 38 | |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 39 | USER root |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame] | 40 | ARG user=onap |
| 41 | ARG group=onap |
| 42 | |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame] | 43 | # set PATH & PYTHONPATH vars |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 44 | ENV APPDIR="/opt/app/pmsh" \ |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 45 | LD_LIBRARY_PATH=/opt/lib \ |
| 46 | PYTHONPATH=${APPDIR}/mod:/opt/lib/python3.9/site-packages \ |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 47 | PATH=$PATH:${APPDIR}/bin \ |
ERIMROB | 2760519 | 2020-05-12 12:56:56 +0100 | [diff] [blame] | 48 | LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \ |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 49 | LOGGER_CONFIG="/opt/app/pmsh/log_config.yaml" |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 50 | |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 51 | WORKDIR $APPDIR |
| 52 | RUN mkdir -p $APPDIR |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 53 | |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 54 | RUN set -eux; \ |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 55 | apk add --no-cache postgresql-libs |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 56 | |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 57 | COPY ./pmsh_service ./bin |
| 58 | COPY log_config.yaml ./ |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 59 | |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 60 | # onap user & group already avaliable, create home dir |
| 61 | RUN mkdir -p /home/$user && \ |
| 62 | chown -R $user:$group /home/$user && \ |
efiacor | e783ede | 2020-08-28 14:00:14 +0100 | [diff] [blame] | 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 | |
Alexander Mazuruk | 835ad81 | 2021-04-12 18:48:00 +0200 | [diff] [blame] | 70 | ENTRYPOINT ["python", "/opt/app/pmsh/bin/pmsh_service_main.py"] |