From c307163822736f0db2c5656219fda60103743ecd Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 22 Jun 2022 11:56:23 +0100 Subject: OpenSuse docker file for drools-pdp Issue-ID: POLICY-4193 Signed-off-by: danielhanrahan Change-Id: Ia3984d93b3aa6ec8daba61201216b03932f6d9ce --- packages/docker/pom.xml | 2 +- packages/docker/src/main/docker/suse.Dockerfile | 93 +++++++++++++++++++++++++ packages/install/src/files/base.conf | 2 +- packages/pom.xml | 18 ++++- 4 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 packages/docker/src/main/docker/suse.Dockerfile diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index d4c23356..e9dea0f0 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -80,7 +80,7 @@ onap/policy-drools try - Dockerfile + ${dockerFile} ${project.version} ${project.version}-${maven.build.timestamp} diff --git a/packages/docker/src/main/docker/suse.Dockerfile b/packages/docker/src/main/docker/suse.Dockerfile new file mode 100644 index 00000000..048546b3 --- /dev/null +++ b/packages/docker/src/main/docker/suse.Dockerfile @@ -0,0 +1,93 @@ +#------------------------------------------------------------------------------- +# Dockerfile +# ============LICENSE_START======================================================= +# Copyright (C) 2022 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +#------------------------------------------------------------------------------- +FROM opensuse/leap:15.3 + +LABEL maintainer="Policy Team" + +ARG BUILD_VERSION_DROOLS=${BUILD_VERSION_DROOLS} +ARG POLICY_LOGS=/var/log/onap/policy/pdpd +ARG POLICY_INSTALL=/tmp/policy-install +ARG MVN_SNAPSHOT_REPO_URL +ARG MVN_RELEASE_REPO_URL +ARG http_proxy + +ENV BUILD_VERSION_DROOLS $BUILD_VERSION_DROOLS +ENV JAVA_HOME /usr/lib64/jvm/java-11-openjdk +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 +ENV POLICY_INSTALL $POLICY_INSTALL +ENV POLICY_INSTALL_INIT $POLICY_INSTALL/config +ENV POLICY_LOGS $POLICY_LOGS +ENV POLICY_HOME /opt/app/policy +ENV POLICY_CONFIG $POLICY_HOME/config +ENV POLICY_LOGBACK $POLICY_CONFIG/logback.xml +ENV POLICY_DOCKER true +ENV MVN_SNAPSHOT_REPO_URL $MVN_SNAPSHOT_REPO_URL +ENV MVN_RELEASE_REPO_URL $MVN_RELEASE_REPO_URL +ENV http_proxy $http_proxy + +RUN zypper -n -q install --no-recommends \ + curl \ + gzip \ + java-11-openjdk-devel \ + maven \ + mariadb-client \ + netcat-openbsd \ + python3 \ + python3-pip \ + sysvinit-tools \ + tar \ + unzip \ + && zypper -n -q update && zypper -n -q clean --all \ + && python3 -m pip install --no-cache-dir --upgrade setuptools http-prompt \ + && python3 -m pip install --no-cache-dir httpie \ + && groupadd --system policy \ + && useradd --system --shell /bin/sh -m -G policy policy \ + && mkdir -p $POLICY_HOME $POLICY_CONFIG $POLICY_LOGS $POLICY_INSTALL $POLICY_INSTALL_INIT \ + && chown -R policy:policy $POLICY_HOME $POLICY_CONFIG $POLICY_LOGS $POLICY_INSTALL $POLICY_INSTALL_INIT + +COPY --chown=policy:policy /maven/install-drools.zip pdpd-entrypoint.sh $POLICY_INSTALL/ + +WORKDIR $POLICY_INSTALL +USER policy:policy + +SHELL ["/bin/sh", "-c"] +RUN unzip -o install-drools.zip && \ + rm install-drools.zip && \ + chown -R policy:policy * && \ + mkdir -p $POLICY_HOME/logs $POLICY_HOME/config $HOME/.m2 && \ + tar -C $POLICY_HOME -xvf base-${BUILD_VERSION_DROOLS}.tar.gz --no-same-owner && \ + unzip policy-management-${BUILD_VERSION_DROOLS}.zip -d $POLICY_HOME && \ + echo "source $POLICY_HOME/etc/profile.d/env.sh" >> "$HOME/.profile" && \ + mv pdpd-entrypoint.sh $POLICY_HOME/bin/ && \ + chmod 700 $POLICY_HOME/bin/* && \ + chmod 600 $POLICY_HOME/config/* && \ + rm -f $POLICY_INSTALL/*.conf && \ + . $POLICY_HOME/etc/profile.d/env.sh && \ + $POLICY_HOME/bin/features install healthcheck distributed-locking lifecycle no-locking legacy-config && \ + $POLICY_HOME/bin/features enable lifecycle && \ + find $HOME/.m2/ -name _maven.repositories -exec rm -v {} \; && \ + find $HOME/.m2/ -name _remote.repositories -exec rm -v {} \; && \ + rm $POLICY_INSTALL/policy-management-${BUILD_VERSION_DROOLS}.zip \ + $POLICY_INSTALL/base-${BUILD_VERSION_DROOLS}.tar.gz 2> /dev/null + +EXPOSE 9696 6969 +ENTRYPOINT ["/opt/app/policy/bin/pdpd-entrypoint.sh"] +CMD ["boot"] diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf index 86eb934e..ecd9e22b 100644 --- a/packages/install/src/files/base.conf +++ b/packages/install/src/files/base.conf @@ -4,6 +4,7 @@ # ================================================================================ # Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved. # Modifications Copyright (C) 2020 Bell Canada. +# Modifications Copyright (C) 2022 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +28,6 @@ JVM_OPTIONS=-server -Xms512m -Xmx1024m POLICY_HOME=/opt/app/policy POLICY_LOGS=/opt/app/policy/logs -JAVA_HOME=/usr/lib/jvm/java-11-openjdk KEYSTORE=/opt/app/policy/etc/ssl/policy-keystore KEYSTORE_PASSWD=Pol1cy_0nap diff --git a/packages/pom.xml b/packages/pom.xml index 7ae3a5a4..b049dcf0 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -4,13 +4,14 @@ ================================================================================ Copyright (C) 2017, 2019-2020 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019-2020 Bell Canada. + Modifications Copyright (C) 2022 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,6 +58,19 @@ false + Dockerfile + + + + dockersuse + + base + install + docker + + + false + suse.Dockerfile -- cgit 1.2.3-korg