summaryrefslogtreecommitdiffstats
path: root/vnfs
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2019-08-29 15:49:46 -0700
committerMarco Platania <platania@research.att.com>2019-08-30 12:45:48 +0000
commitaeb2c59b1251f22914547deeecbbdd940f17756f (patch)
treee3154678a2ed493141f8c99523faf635b5f25180 /vnfs
parent42d603c26fea17015c44323e82ed586231dc6bd6 (diff)
Added docker image builder for go MS
Added builder image and script to build golang based microservice images Issue-ID: ONAPARC-366 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com> Change-Id: I90bd0cfbd5dfbe1d5a4233673e68fac1bc60accf
Diffstat (limited to 'vnfs')
-rw-r--r--vnfs/DAaaS/microservices/Dockerfile.ci33
-rwxr-xr-xvnfs/DAaaS/microservices/build-image.sh18
2 files changed, 51 insertions, 0 deletions
diff --git a/vnfs/DAaaS/microservices/Dockerfile.ci b/vnfs/DAaaS/microservices/Dockerfile.ci
new file mode 100644
index 00000000..1040c142
--- /dev/null
+++ b/vnfs/DAaaS/microservices/Dockerfile.ci
@@ -0,0 +1,33 @@
+FROM ubuntu:18.04
+
+RUN apt-get -yqq update && apt-get -yqq install lsb-release apt-transport-https \
+ ca-certificates \
+ curl \
+ gnupg-agent \
+ software-properties-common
+RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
+RUN add-apt-repository \
+ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+ $(lsb_release -cs) \
+ stable"
+RUN apt-get -yqq update && apt-get -yqq install docker-ce docker-ce-cli mercurial
+RUN rm -rf /var/lib/apt/lists/*
+WORKDIR /app
+
+#### Go v1.12.5
+ENV GOLANG_VERSION 1.12.5
+RUN curl -sSL https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz \
+ | tar -v -C /usr/local -xz
+ENV PATH /usr/local/go/bin:$PATH
+RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
+ENV GOROOT /usr/local/go
+ENV GOPATH /app/go
+ENV PATH /app/go/bin:$PATH
+#### Go v1.12.5
+
+RUN git clone https://github.com/onap/demo.git
+WORKDIR /app/demo/vnfs/DAaaS/microservices
+ENV RELEASE_VERSION=v0.9.0
+RUN curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
+RUN chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
+ENV GO111MODULE=on \ No newline at end of file
diff --git a/vnfs/DAaaS/microservices/build-image.sh b/vnfs/DAaaS/microservices/build-image.sh
new file mode 100755
index 00000000..61e09057
--- /dev/null
+++ b/vnfs/DAaaS/microservices/build-image.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+OPERATOR=$1
+OPERATOR_IMAGE=$2
+echo "Building $OPERATOR image $OPERATOR_IMAGE"
+CMD="export GO111MODULE=on && cd $OPERATOR && operator-sdk build $OPERATOR_IMAGE"
+
+docker build -f Dockerfile.ci . -t operator-image-builder:latest
+
+docker run --rm -it \
+ -v /var/run/docker.sock:/var/run/docker.sock \
+ -v $PWD:/app/demo/vnfs/DAaaS/microservices \
+ operator-image-builder:latest bash -c "$CMD"
+