From 2d223b10ab87c50d6851b3e9d5e1c5f747b85585 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Thu, 13 Aug 2020 08:28:45 +0000 Subject: Run in Python 3.8 Use image recommended by SECCOM Issue-ID: DCAEGEN2-2292 Signed-off-by: Michal Jagiello Change-Id: I230eb5d50cce46659752206a2435242923725189 --- components/pm-subscription-handler/Dockerfile | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'components/pm-subscription-handler/Dockerfile') diff --git a/components/pm-subscription-handler/Dockerfile b/components/pm-subscription-handler/Dockerfile index 566b2ab9..a30c3484 100644 --- a/components/pm-subscription-handler/Dockerfile +++ b/components/pm-subscription-handler/Dockerfile @@ -1,5 +1,6 @@ # ============LICENSE_START=================================================== # Copyright (C) 2020 Nordix Foundation. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,28 +17,27 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END===================================================== -FROM python:3.7-slim-buster +FROM python:3.8.2-alpine3.11 MAINTAINER lego@est.tech -ENV PMSHUSER=pmsh \ - APPDIR="/opt/app/pmsh" \ - # set PATH & PYTHONPATH vars - PATH=/usr/local/lib/python3.7/bin:$PATH:$APPDIR/bin \ - PYTHONPATH=/usr/local/lib/python3.7/site-packages:./mod:./:$PYTHONPATH:$APPDIR/bin \ +ARG user=onap +ARG group=onap + +WORKDIR /app + +# set PATH & PYTHONPATH vars +ENV PATH=/usr/local/lib/python3.8/bin:$PATH:./bin \ + PYTHONPATH=/usr/local/lib/python3.8/site-packages:./mod:./:$PYTHONPATH:./bin \ REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt \ LOGS_PATH="/var/log/ONAP/dcaegen2/services/pmsh" \ LOGGER_CONFIG=/opt/app/pmsh/log_config.yaml -WORKDIR $APPDIR - # add non root user & group -RUN addgroup --system $PMSHUSER && adduser --ingroup $PMSHUSER --system $PMSHUSER && \ +RUN addgroup --system $user && adduser --ingroup $user --system $user && \ # create and chown the LOGS_PATH - apt-get update && \ - apt-get install -y --no-install-recommends vim-tiny && \ - apt-get clean && rm -rf /var/lib/apt/lists/* && \ + apk add build-base libffi-dev postgresql-dev && \ mkdir -p $LOGS_PATH && \ - chown -R $PMSHUSER:$PMSHUSER $LOGS_PATH + chown -R $user:$group $LOGS_PATH COPY setup.py ./ COPY requirements.txt ./ @@ -49,11 +49,8 @@ RUN pip install --upgrade pip && \ pip install -r requirements.txt && \ pip install -e . && \ # change own & perms on entrypoint - chown -R $PMSHUSER:$PMSHUSER $APPDIR && \ - chmod 500 $APPDIR/bin/*.py - -# set to non root user -USER $PMSHUSER + chown -R $user:$group . && \ + chmod 500 ./bin/*.py # run the app ENTRYPOINT ["python", "./bin/pmsh_service_main.py"] \ No newline at end of file -- cgit 1.2.3-korg