The goal of this document is to investigate how to make my first policy example be in working condition.



Currently implemented

The way the docker was created is no longer able to build a docker image, because the base image apex/base no longer exists.

Old Dockerfile
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
#  Copyright (C) 2016-2018 Ericsson. 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.
# 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=========================================================
#-------------------------------------------------------------------------------

#
# Docker file to build an image the MyFirstPolicyFile2StdoutJsonEvent example 
#
# apex/myfirstpolicyfile2stdoutjsonevent:1

FROM apex/base
MAINTAINER John Keeney John.Keeney@ericsson.com

EXPOSE 12345
USER apexuser:apexuser
ENTRYPOINT ["apexEngine.sh"]
CMD ["-c", "examples/config/MyFirstPolicy/1/MyFirstPolicyConfigFile2StdoutJsonEvent.json"]

Dockerfile Implementation #1

There are two ways the docker files is implemented and the first is that the docker file bases it's image from ONAP/POLICY-JDK-ALPINE:
It's a minimalistic image that has the necessary dependencies to run any policy applications.

Implementation #1
onap/policy-jdk-alpine:2.5.0-SNAPSHOT

Dockerfile Implementation #2

The second way the docker file is implemented it bases the image from OPENSUSE/LEAP:
It's an opensuse image that a policy application runs on.

Implemenation #2
FROM opensuse/leap:15.4

Initial Section of Docker File

In the initial section of the dockerfile bases on the busybox image and has an alias as tarball.  It then creates a directory structure /packages and /extracted then it copies the file 

apex-pdp-package-full.tar.gz to the /packages directory and then it extracts it to the /extracted directory.

Tar File

The tar file has the following structure.


/bin - contains shell script and bat files.
/etc - contains configuation files for logging, onap policy framework configs, ssl certificates, versioning and more.
/examples - json files, and my first example docker file
/lib - java dependencies


Entrypoints and Commands

The entrypoint the dockerfile for my first example uses apexengine.sh which is inside the apex-pdp-package-full.tar.gz and the commands is inside the MyFirstPolicyConfigFile2StdoutJsonEvent.json file.


Once the user builds the docker image it triggers the ApexMain java file which has to be packaged and copied inside the image file, but currently the apex-pdp project packaging is set as pom so it needs to be changed to jar packaging.


  • No labels