diff options
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | docker-compose-integration.yml | 2 | ||||
-rw-r--r-- | docker-compose.yml | 2 | ||||
-rwxr-xr-x | docker_build.sh | 117 | ||||
-rwxr-xr-x | docker_merge.sh | 105 | ||||
-rwxr-xr-x | docker_verify.sh | 89 | ||||
-rw-r--r-- | policy-nexus/Dockerfile | 51 | ||||
-rw-r--r-- | pom.xml | 72 | ||||
-rwxr-xr-x | vagrant/setup_policy.sh | 2 | ||||
-rw-r--r-- | version.properties | 13 |
10 files changed, 4 insertions, 463 deletions
@@ -2,19 +2,9 @@ Copyright 2018 AT&T Intellectual Property. All rights reserved. This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE Full license text at https://creativecommons.org/licenses/by/4.0/legalcode -This source repository contains the files for building the ONAP Policy Engine Docker image policy-nexus. +This source repository contains the files for the ONAP Policy docker-compose configuration -To build it using Maven 3, first build 'policy/common', 'policy/engine', 'policy/drools-pdp', and 'policy/drools-applications' repositories, and then run: mvn prepare-package. This will pull the installation zip files needed for building the policy-pe and policy-drools Docker images into the target directory. It will not actually build the docker images; the following additional steps are needed to accomplish this: - -To build the policy-nexus docker image, run the 'docker build' command on the following directory: - policy-nexus - -For example: -docker build -t onap/policy-nexus policy-nexus - -In addition, this source repository contains a docker-compose.yml file and associated configuration files (in the 'config' directory) that can be used to start up the ONAP Policy Engine docker containers - -If you want to call the docker-compose, the following needs to be setup before doing so: +The following needs to be setup before using docker-compose: chmod +x config/drools/drools-tweaks.sh IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) diff --git a/docker-compose-integration.yml b/docker-compose-integration.yml index a5afd69b..53b592a3 100644 --- a/docker-compose-integration.yml +++ b/docker-compose-integration.yml @@ -24,7 +24,7 @@ services: expose: - 3306 nexus: - image: onap/policy-nexus + image: sonatype/nexus:2.14.8-01 container_name: nexus hostname: nexus pap: diff --git a/docker-compose.yml b/docker-compose.yml index 547f3830..18e0ebd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: ports: - "3306:3306" nexus: - image: sonatype/nexus + image: sonatype/nexus:2.14.8-01 container_name: nexus hostname: nexus restart: always diff --git a/docker_build.sh b/docker_build.sh deleted file mode 100755 index 653ef6d2..00000000 --- a/docker_build.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# Copyright 2018 AT&T Intellectual Property. 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. -# -echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES =================' -DOCKER_REPOSITORY=nexus3.onap.org:10003 -MVN_VERSION=$(cat target/version) -MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version) -TIMESTAMP=$(date -u +%Y%m%dT%H%M%S) -PROXY_ARGS="" -IMAGE=policy-nexus - -if [ $HTTP_PROXY ]; then - PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}" -fi -if [ $HTTPS_PROXY ]; then - PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" -fi - -echo $DOCKER_REPOSITORY -echo $MVN_VERSION -echo $MVN_MAJMIN_VERSION -echo $TIMESTAMP - -if [[ -z $MVN_VERSION ]] -then - echo "MVN_VERSION is empty" - exit 1 -fi - -if [[ -z $MVN_MAJMIN_VERSION ]] -then - echo "MVN_MAJMIN_VERSION is empty" - exit 1 -fi - -if [[ $MVN_VERSION == *"SNAPSHOT"* ]] -then - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-SNAPSHOT" -else - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-STAGING" -fi - -echo $MVN_MAJMIN_VERSION - -echo "Building $IMAGE" -mkdir -p target/$IMAGE -cp $IMAGE/* target/$IMAGE - -# -# This is the local latest tagged image. The Dockerfile's need this to build images -# -TAGS="--tag onap/${IMAGE}:latest" -# -# This is the nexus repo prepended for latest tagged image. -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:latest" -# -# This has the nexus repo prepended and only major/minor version with latest -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" -# -# This has the nexus repo prepended and major/minor/patch version with timestamp -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}Z" - -echo $TAGS - -docker build --quiet ${PROXY_ARGS} $TAGS target/$IMAGE - -if [ $? -ne 0 ] -then - echo "Docker build failed" - docker images - exit 1 -fi - -docker images - -echo "Pushing $IMAGE" - -docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:latest - -if [ $? -ne 0 ] -then - echo "Docker push failed" - exit 1 - -fi - -docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_MAJMIN_VERSION}-latest - -if [ $? -ne 0 ] -then - echo "Docker push failed" - exit 1 - -fi -docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-STAGING-${TIMESTAMP}Z - -if [ $? -ne 0 ] -then - echo "Docker push failed" - exit 1 - -fi diff --git a/docker_merge.sh b/docker_merge.sh deleted file mode 100755 index 6b2c5442..00000000 --- a/docker_merge.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# Copyright 2018 AT&T Intellectual Property. 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. -# -echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES =================' -DOCKER_REPOSITORY=nexus3.onap.org:10003 -MVN_VERSION=$(cat target/version) -MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version) -TIMESTAMP=$(date -u +%Y%m%dT%H%M%S) -PROXY_ARGS="" -IMAGE=policy-nexus - -if [ $HTTP_PROXY ]; then - PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}" -fi -if [ $HTTPS_PROXY ]; then - PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" -fi - -echo $DOCKER_REPOSITORY -echo $MVN_VERSION -echo $MVN_MAJMIN_VERSION -echo $TIMESTAMP - -if [[ -z $MVN_VERSION ]] -then - echo "MVN_VERSION is empty" - exit 1 -fi - -if [[ -z $MVN_MAJMIN_VERSION ]] -then - echo "MVN_MAJMIN_VERSION is empty" - exit 1 -fi - -if [[ $MVN_VERSION == *"SNAPSHOT"* ]] -then - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-SNAPSHOT" -else - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-STAGING" -fi - -echo $MVN_MAJMIN_VERSION - -echo "Building $IMAGE" -mkdir -p target/$IMAGE -cp $IMAGE/* target/$IMAGE - -# -# This is the local latest tagged image. The Dockerfile's need this to build images -# -TAGS="--tag onap/${IMAGE}:latest" -# -# This has the nexus repo prepended and only major/minor version with latest -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" -# -# This has the nexus repo prepended and major/minor/patch version with timestamp -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}Z" - -echo $TAGS - -docker build --quiet ${PROXY_ARGS} $TAGS target/$IMAGE - -if [ $? -ne 0 ] -then - echo "Docker build failed" - docker images - exit 1 -fi - -docker images - -# -# Push image -# -echo "Pushing $IMAGE" -docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_MAJMIN_VERSION}-latest - -if [ $? -ne 0 ] -then - echo "Docker push failed" - exit 1 -fi - -docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-${TIMESTAMP}Z - -if [ $? -ne 0 ] -then - echo "Docker push failed" - exit 1 -fi diff --git a/docker_verify.sh b/docker_verify.sh deleted file mode 100755 index 0b22ae46..00000000 --- a/docker_verify.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# Copyright 2018 AT&T Intellectual Property. 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. -# -echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES =================' -# -# JUST VERIFY ONLY - NO PUSHING -# -DOCKER_REPOSITORY=nexus3.onap.org:10003 -MVN_VERSION=$(cat target/version) -MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version) -TIMESTAMP=$(date -u +%Y%m%dT%H%M%S) -PROXY_ARGS="" -IMAGE=policy-nexus - -if [ $HTTP_PROXY ]; then - PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}" -fi -if [ $HTTPS_PROXY ]; then - PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" -fi - -echo $DOCKER_REPOSITORY -echo $MVN_VERSION -echo $MVN_MAJMIN_VERSION -echo $TIMESTAMP - -if [[ -z $MVN_VERSION ]] -then - echo "MVN_VERSION is empty" - exit 1 -fi - -if [[ -z $MVN_MAJMIN_VERSION ]] -then - echo "MVN_MAJMIN_VERSION is empty" - exit 1 -fi - -if [[ $MVN_VERSION == *"SNAPSHOT"* ]] -then - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-SNAPSHOT" -else - MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-STAGING" -fi - -echo $MVN_MAJMIN_VERSION - -echo "Building $IMAGE" -mkdir -p target/$IMAGE -cp $IMAGE/* target/$IMAGE - -# -# This is the local latest tagged image. The Dockerfile's need this to build images -# -TAGS="--tag onap/${IMAGE}:latest" -# -# This has the nexus repo prepended and only major/minor version with latest -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" -# -# This has the nexus repo prepended and major/minor/patch version with timestamp -# -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}Z" - -echo $TAGS - -docker build --quiet ${PROXY_ARGS} $TAGS target/$IMAGE - -if [ $? -ne 0 ] -then - echo "Docker build failed" - docker images - exit 1 -fi - -docker images - diff --git a/policy-nexus/Dockerfile b/policy-nexus/Dockerfile deleted file mode 100644 index 144cebbf..00000000 --- a/policy-nexus/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. 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. -FROM ubuntu:14.04 - -ARG HTTP_PROXY=${HTTP_PROXY} -ARG HTTPS_PROXY=${HTTPS_PROXY} - -ENV http_proxy $HTTP_PROXY -ENV https_proxy $HTTPS_PROXY - -RUN \ - apt-get clean && \ - apt-get update && \ - apt-get install -y zip unzip curl wget ssh telnet maven && \ - apt-get install -y software-properties-common && \ - apt-get install -y jq httpie && \ - apt-get install -y python-pip && \ - add-apt-repository ppa:openjdk-r/ppa && \ - apt-get clean && \ - apt-get update && \ - apt-get install -y openjdk-8-jdk - -RUN useradd --create-home --shell /bin/bash policy - -# note that in following command sequence, wget exit status is 1 even on success, -# so can't use && for conditional execution of next command -RUN \ - cd /tmp && \ - wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.2-01-bundle.tar.gz ; \ - mkdir /opt/nexus && cd /opt/nexus && \ - tar xfz /tmp/nexus-2.14.2-01-bundle.tar.gz && \ - useradd --create-home --shell /bin/bash nexus && \ - chown -R nexus * - -# make the sonatype-work directory persistent -VOLUME /opt/nexus/sonatype-work - -USER nexus -CMD bash -c "/opt/nexus/nexus-2.14.2-01/bin/nexus start && sleep 1000d" - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 78550c9e..00000000 --- a/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - ONAP Policy Engine - Docker files - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. 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. - ============LICENSE_END========================================================= - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.oparent</groupId> - <artifactId>oparent</artifactId> - <version>1.1.0</version> - <relativePath/> - </parent> - - <groupId>org.onap.policy.docker</groupId> - <artifactId>docker</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>pom</packaging> - <name>Policy Engine - Docker build</name> - <description>ONAP Policy Docker Build</description> - - <properties> - <nexusproxy>https://nexus.onap.org</nexusproxy> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.6.0</version> - <executions> - <execution> - <id>get-target-version</id> - <phase>prepare-package</phase> - <goals> - <goal>exec</goal> - </goals> - </execution> - </executions> - <configuration> - <executable>echo</executable> - <workingDirectory>${project.build.directory}</workingDirectory> - <arguments> - <argument>${project.version}</argument> - </arguments> - <outputFile>${project.build.directory}/version</outputFile> - </configuration> - </plugin> - - </plugins> - </build> - -</project> diff --git a/vagrant/setup_policy.sh b/vagrant/setup_policy.sh index 6cf837f9..18bb3284 100755 --- a/vagrant/setup_policy.sh +++ b/vagrant/setup_policy.sh @@ -41,8 +41,6 @@ cd $HOME git clone http://gerrit.onap.org/r/policy/docker cd docker -sudo docker build -t onap/policy-nexus policy-nexus - cd $HOME/docker chmod +x config/drools/drools-tweaks.sh echo 192.168.0.10 > config/pe/ip_addr.txt diff --git a/version.properties b/version.properties deleted file mode 100644 index faf06bbb..00000000 --- a/version.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Versioning variables -# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) -# because they are used in Jenkins, whose plug-in doesn't support - -major=1 -minor=2 -patch=0 - -base_version=${major}.${minor}.${patch} - -# Release must be completed with git revision # in Jenkins -release_version=${base_version} -snapshot_version=${base_version}-SNAPSHOT |