diff options
Diffstat (limited to 'aai-common-docker/aai-common-images')
4 files changed, 201 insertions, 0 deletions
diff --git a/aai-common-docker/aai-common-images/README.md b/aai-common-docker/aai-common-images/README.md new file mode 100644 index 00000000..82131247 --- /dev/null +++ b/aai-common-docker/aai-common-images/README.md @@ -0,0 +1,24 @@ +# AAI Common Docker README + +### Building the image + +Run the following command to build AAI common images at internal network + +```bash + export NEW_VERSION=<NEW_VERSION> + export BASE_IMAGE=<alpine | ubuntu> + sudo docker build -t \ + nexus3.onap.org:10003/onap/aai-common-${BASE_IMAGE}:${NEW_VERSION} \ + -f Dockerfile.${BASE_IMAGE} . +``` + +Replace the **NEW\_VERSION** with the new docker image version for aai-common. +Set **BASE\_IMAGE** to **alpine** or **ubuntu** to build aai-common-alpine or +aai-common-ubuntu image. + +NOTE: In order to push images into Nexus3, you have to be logged into Nexus3 +with appropriate credentials first. + +NOTE2: Both alpine and ubuntu based aai-common images are built automatically +by jenkins jobs and they are available at official ONAP docker registry +(currently nexus3). diff --git a/aai-common-docker/aai-common-images/pom.xml b/aai-common-docker/aai-common-images/pom.xml new file mode 100644 index 00000000..2ecf0295 --- /dev/null +++ b/aai-common-docker/aai-common-images/pom.xml @@ -0,0 +1,103 @@ +<!-- + + ============LICENSE_START======================================================= + org.onap.aai + ================================================================================ + Copyright © 2017-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. + ============LICENSE_END========================================================= + +--> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + 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.aai.aai-common</groupId> + <artifactId>aai-common-docker</artifactId> + <version>1.6.0-SNAPSHOT</version> + </parent> + + <artifactId>aai-common-images</artifactId> + <version>1.6.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>aai-aai-common-images</name> + <description>Contains dockerfiles for aai-common images (alpine and ubuntu based).</description> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>${docker.fabric.version}</version> + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> + <images> + <image> + <name>${docker.push.registry}/${aai.docker.namespace}/aai-common-alpine:%l + </name> + <build> + <filter>@</filter> + <tags> + <tag>latest</tag> + </tags> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir> + <dockerFile>Dockerfile.alpine</dockerFile> + </build> + </image> + <image> + <name>${docker.push.registry}/${aai.docker.namespace}/aai-common-ubuntu:%l + </name> + <build> + <filter>@</filter> + <tags> + <tag>latest</tag> + </tags> + <cleanup>try</cleanup> + <dockerFile>Dockerfile.ubuntu</dockerFile> + <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>clean-images</id> + <phase>pre-clean</phase> + <goals> + <goal>remove</goal> + </goals> + <configuration> + <removeAll>true</removeAll> + </configuration> + </execution> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.alpine b/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.alpine new file mode 100644 index 00000000..915c511e --- /dev/null +++ b/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.alpine @@ -0,0 +1,39 @@ +FROM openjdk:8-jre-alpine3.9 + +# Set the version of the gosu command and if needs to be, it can be modified at runtime +ENV GOSU_VERSION 1.10 + +# For building the image in a proxy environment if necessary +ARG HTTP_PROXY +ARG HTTPS_PROXY +ARG no_proxy + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} +ENV http_proxy ${HTTP_PROXY} +ENV https_proxy ${HTTPS_PROXY} +ENV no_proxy 127.0.0.1,localhost,${no_proxy} + +RUN \ + # Put all the dependencies into this variable to easily install everything + DEPS="ca-certificates \ + curl \ + dpkg \ + fastjar \ + jq \ + loksh \ + bash \ + netcat-openbsd \ + openssl \ + shadow \ + util-linux \ + wget" \ + && apk add --no-cache ${DEPS} \ + # need fastjar for some projects to update app's jar on container restart + && ln -snf /usr/bin/fastjar $JAVA_HOME/bin/jar \ + # Get the dpkg to properly download and install that version compatible to install GOSU on the image + && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ + # Downloads the gosu command based on the dpkg version and gosu version supplied + && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ + # Use GPG to install the gosu application locally + && chmod +x /usr/local/bin/gosu diff --git a/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.ubuntu b/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.ubuntu new file mode 100644 index 00000000..d81579d4 --- /dev/null +++ b/aai-common-docker/aai-common-images/src/main/docker/Dockerfile.ubuntu @@ -0,0 +1,35 @@ +FROM ubuntu:16.04 + +# Set the version of the gosu command and if needs to be, it can be modified at runtime +ENV GOSU_VERSION 1.10 + +# For building the image in a proxy environment if necessary +ARG HTTP_PROXY +ARG HTTPS_PROXY +ARG no_proxy + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} +ENV http_proxy ${HTTP_PROXY} +ENV https_proxy ${HTTPS_PROXY} +ENV no_proxy 127.0.0.1,localhost,${no_proxy} + +RUN \ + # Creates the group and user with the name aaiadmin for aai + #groupadd -r aaiadmin && useradd -r -g aaiadmin aaiadmin && \ + # Put all the dependencies into this variable to easily install everything + DEPS="ca-certificates curl git fastjar jq ksh libcurl3 netcat openjdk-8-jre-headless vim uuid-runtime wget" && \ + # Run the update before for the package manager to properly fetch install packages + apt-get update && \ + # Install the recommended dependencies + apt-get install -y --no-install-recommends $DEPS && \ + # Remove all the cache for the apt package manager + rm -rf /var/lib/apt/lists/* && \ + # Get the dpkg to properly download and install that version compatible to install GOSU on the image + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" && \ + \ + # Downloads the gosu command based on the dpkg version and gosu version supplied + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + \ + # Use GPG to install the gosu application locally + chmod +x /usr/local/bin/gosu |