aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-02-14 13:45:22 +0100
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2019-02-14 14:43:51 +0100
commitae7b27aa50cdc3cbcf96139050f1c2dd9956cfaa (patch)
tree76c714bda39c21ce5981ddf820ebd8e233a50724
parent6c9efd47bfae32b811761e3c2f2ceba545411bb7 (diff)
Create a Dockerfile for CDS-UI
Dockerfile done in order to be able to construct Helm chart for the project. Final image is pretty large because of the many dependencies npm downloads. Created a pom.xml trying to mimic what's done in ccsdk/distribution Change-Id: I502a08066ceaa8984f77116f3c3bf4505da3c934 Issue-ID: CCSDK-1015 Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
-rw-r--r--.gitignore82
-rw-r--r--.gitreview4
-rw-r--r--TagVersion.groovy41
-rw-r--r--cds-ui/.dockerignore85
-rw-r--r--cds-ui/Dockerfile35
-rw-r--r--pom.xml97
6 files changed, 336 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..398da3722
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,82 @@
+# Node.js
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+dist/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 000000000..70f56652a
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.onap.org
+port=29418
+project=ccsdk/cds.git
diff --git a/TagVersion.groovy b/TagVersion.groovy
new file mode 100644
index 000000000..68a8b7806
--- /dev/null
+++ b/TagVersion.groovy
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CCSDK
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.ccsdk.distribution
+
+
+def versionArray;
+if ( project.properties['ccsdk.project.version'] != null ) {
+ versionArray = project.properties['ccsdk.project.version'].split('\\.');
+}
+
+if ( project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT") ) {
+ patchArray = versionArray[2].split('-');
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-"+project.properties['ccsdk.build.timestamp'];
+} else {
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-"+project.properties['ccsdk.build.timestamp'];
+}
diff --git a/cds-ui/.dockerignore b/cds-ui/.dockerignore
new file mode 100644
index 000000000..00137e31f
--- /dev/null
+++ b/cds-ui/.dockerignore
@@ -0,0 +1,85 @@
+# editor config
+.editorconfig
+
+# Node.js
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+client/node_modules/
+client/jspm_packages/
+client/dist/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
diff --git a/cds-ui/Dockerfile b/cds-ui/Dockerfile
new file mode 100644
index 000000000..5bf65f428
--- /dev/null
+++ b/cds-ui/Dockerfile
@@ -0,0 +1,35 @@
+# Building client html and js files
+FROM alpine:3.8 as builder
+
+RUN apk add --no-cache npm
+
+WORKDIR /opt/cds-ui/client/
+
+COPY client/package.json /opt/cds-ui/client/
+
+RUN npm install
+
+COPY client /opt/cds-ui/client/
+
+RUN npm run build
+
+
+# Building and creating server
+FROM alpine:3.8
+
+WORKDIR /opt/cds-ui/
+
+RUN apk add --no-cache npm
+
+COPY server/package.json /opt/cds-ui/
+
+RUN npm install
+
+COPY server /opt/cds-ui/
+COPY --from=builder /opt/cds-ui/server/public /opt/cds-ui/public
+
+RUN npm run build
+
+EXPOSE 3000
+
+CMD [ "npm", "start" ]
diff --git a/pom.xml b/pom.xml
index 5286e6374..1d69d2fe2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<!--
+<!--
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
@@ -21,23 +21,33 @@ limitations under the License.
<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.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1-SNAPSHOT</version>
<relativePath/>
</parent>
-
+
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>controller-design-studio</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
-
-
+
<name>controller-design-studio</name>
-
+ <description>Creates Controller Design Studio UI Docker container</description>
+
+ <properties>
+ <image.name>onap/ccsdk-cds-ui</image.name>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ <ccsdk.distribution.version>${project.version}</ccsdk.distribution.version>
+ <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <docker.verbose>true</docker.verbose>
+ </properties>
+
+<!--
<modules>
<module>cds-ui/client</module>
<module>cds-ui/server</module>
@@ -48,8 +58,79 @@ limitations under the License.
<npm.executable>npm</npm.executable>
<onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
</properties>
+-->
+
+<build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/TagVersion.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.28.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/cds-ui</dockerFileDir>
+ <tags>
+ <tag>${project.docker.latestminortag.version}</tag>
+ <tag>${project.docker.latestfulltag.version}</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <organization>
+ <name>ONAP</name>
+ </organization>
-
-</project> \ No newline at end of file
+</project>