blob: a30c34845a0efcda803f271db604581d160a1acf [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
Michal Jagiello2d223b12020-08-13 08:28:45 +000020FROM python:3.8.2-alpine3.11
efiacor9b532682019-11-06 11:08:54 +000021MAINTAINER lego@est.tech
22
Michal Jagiello2d223b12020-08-13 08:28:45 +000023ARG user=onap
24ARG group=onap
25
26WORKDIR /app
27
28# set PATH & PYTHONPATH vars
29ENV PATH=/usr/local/lib/python3.8/bin:$PATH:./bin \
30 PYTHONPATH=/usr/local/lib/python3.8/site-packages:./mod:./:$PYTHONPATH:./bin \
efiacor8b3fc622020-01-24 13:19:01 +000031 REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \
ERIMROB27605192020-05-12 12:56:56 +010032 LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \
33 LOGGER_CONFIG=/opt/app/pmsh/log_config.yaml
efiacor9b532682019-11-06 11:08:54 +000034
efiacor9b532682019-11-06 11:08:54 +000035 # add non root user & group
Michal Jagiello2d223b12020-08-13 08:28:45 +000036RUN addgroup --system $user && adduser --ingroup $user --system $user && \
efiacorbc9f41e2020-02-12 23:31:16 +000037 # create and chown the LOGS_PATH
Michal Jagiello2d223b12020-08-13 08:28:45 +000038 apk add build-base libffi-dev postgresql-dev && \
efiacorbc9f41e2020-02-12 23:31:16 +000039 mkdir -p $LOGS_PATH && \
Michal Jagiello2d223b12020-08-13 08:28:45 +000040 chown -R $user:$group $LOGS_PATH
efiacor9b532682019-11-06 11:08:54 +000041
42COPY setup.py ./
43COPY requirements.txt ./
44COPY ./pmsh_service ./bin/
ERIMROB27605192020-05-12 12:56:56 +010045COPY log_config.yaml /opt/app/pmsh/
efiacor9b532682019-11-06 11:08:54 +000046
47 # run the pip install
48RUN pip install --upgrade pip && \
49 pip install -r requirements.txt && \
50 pip install -e . && \
51 # change own & perms on entrypoint
Michal Jagiello2d223b12020-08-13 08:28:45 +000052 chown -R $user:$group . && \
53 chmod 500 ./bin/*.py
efiacor9b532682019-11-06 11:08:54 +000054
55# run the app
AndyWalshede549f52020-02-13 12:55:49 +000056ENTRYPOINT ["python", "./bin/pmsh_service_main.py"]