blob: e1dd16fe5b16ecb88fc2bf075e29cf95a14710c3 [file] [log] [blame]
efiacor9b532682019-11-06 11:08:54 +00001# ============LICENSE_START===================================================
2# Copyright (C) 2019 Nordix Foundation.
3# ============================================================================
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# SPDX-License-Identifier: Apache-2.0
17# ============LICENSE_END=====================================================
18
19FROM python:3.7-slim-buster
20MAINTAINER lego@est.tech
21
22ENV PMSHUSER=pmsh \
23 APPDIR="/opt/app/pmsh" \
24 # turn on file based EELF logging
25 PROD_LOGGING=1 \
26 # set PATH & PYTHONPATH vars
27 PATH=/usr/local/lib/python3.7/bin:$PATH:$APPDIR/bin \
28 PYTHONPATH=/usr/local/lib/python3.7/site-packages:./mod:./:$PYTHONPATH:$APPDIR/bin \
29 REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
30
31WORKDIR $APPDIR
32
33 # add non root user & group
34RUN addgroup --system $PMSHUSER && adduser --ingroup $PMSHUSER --system $PMSHUSER && \
35 # create logs dir and change permissions
36 mkdir -p /var/log/ONAP/$PMSHUSER/logs && \
37 chmod a+w /var/log/ONAP/$PMSHUSER/logs
38
39COPY setup.py ./
40COPY requirements.txt ./
41COPY ./pmsh_service ./bin/
42
43 # run the pip install
44RUN pip install --upgrade pip && \
45 pip install -r requirements.txt && \
46 pip install -e . && \
47 # change own & perms on entrypoint
48 chown -R $PMSHUSER:$PMSHUSER $APPDIR && \
49 chmod 500 $APPDIR/bin/*.py
50
51# set to non root user
52USER $PMSHUSER
53
54# run the app
55ENTRYPOINT ["python", "./bin/pmsh_service.py"]