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 | |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 20 | FROM python:3.8.2-alpine3.11 |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 21 | MAINTAINER lego@est.tech |
| 22 | |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 23 | ARG user=onap |
| 24 | ARG group=onap |
| 25 | |
| 26 | WORKDIR /app |
| 27 | |
| 28 | # set PATH & PYTHONPATH vars |
| 29 | ENV PATH=/usr/local/lib/python3.8/bin:$PATH:./bin \ |
| 30 | PYTHONPATH=/usr/local/lib/python3.8/site-packages:./mod:./:$PYTHONPATH:./bin \ |
efiacor | 8b3fc62 | 2020-01-24 13:19:01 +0000 | [diff] [blame] | 31 | REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \ |
ERIMROB | 2760519 | 2020-05-12 12:56:56 +0100 | [diff] [blame] | 32 | LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \ |
| 33 | LOGGER_CONFIG=/opt/app/pmsh/log_config.yaml |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 34 | |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 35 | # add non root user & group |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 36 | RUN addgroup --system $user && adduser --ingroup $user --system $user && \ |
efiacor | bc9f41e | 2020-02-12 23:31:16 +0000 | [diff] [blame] | 37 | # create and chown the LOGS_PATH |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 38 | apk add build-base libffi-dev postgresql-dev && \ |
efiacor | bc9f41e | 2020-02-12 23:31:16 +0000 | [diff] [blame] | 39 | mkdir -p $LOGS_PATH && \ |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 40 | chown -R $user:$group $LOGS_PATH |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 41 | |
| 42 | COPY setup.py ./ |
| 43 | COPY requirements.txt ./ |
| 44 | COPY ./pmsh_service ./bin/ |
ERIMROB | 2760519 | 2020-05-12 12:56:56 +0100 | [diff] [blame] | 45 | COPY log_config.yaml /opt/app/pmsh/ |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 46 | |
| 47 | # run the pip install |
| 48 | RUN pip install --upgrade pip && \ |
| 49 | pip install -r requirements.txt && \ |
| 50 | pip install -e . && \ |
| 51 | # change own & perms on entrypoint |
Michal Jagiello | 2d223b1 | 2020-08-13 08:28:45 +0000 | [diff] [blame^] | 52 | chown -R $user:$group . && \ |
| 53 | chmod 500 ./bin/*.py |
efiacor | 9b53268 | 2019-11-06 11:08:54 +0000 | [diff] [blame] | 54 | |
| 55 | # run the app |
AndyWalshe | de549f5 | 2020-02-13 12:55:49 +0000 | [diff] [blame] | 56 | ENTRYPOINT ["python", "./bin/pmsh_service_main.py"] |