Commit ff135331 authored by Ryan Berkheimer's avatar Ryan Berkheimer
Browse files

completed and validated build update for JAR size reduction (13.7 MB to 325...

completed and validated build update for JAR size reduction (13.7 MB to 325 KB). Added initial templates for Dockerfile.deploy and Dockerfile.demo (these still need work.)
parent 2da9d972
Pipeline #5837 failed with stage
in 0 seconds
......@@ -15,14 +15,13 @@ LIBRARY_NAME=messageapi
MAJOR_VERSION=1
MINOR_VERSION=0
PATCH_VERSION=0
EXTENSION_VERSION=all
#Root Path Computation
PROJECT_ROOT:=$(PWD)
#Java Related Paths
JAR_SRC_DIR=$(PROJECT_ROOT)/build/libs
SRC_JAR=$(LIBRARY_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)-$(EXTENSION_VERSION).jar
SRC_JAR=$(LIBRARY_NAME).jar
JAVA_ARTIFACT_DIR=$(PROJECT_ROOT)/dist/artifacts/java/$(LIBRARY_NAME)_$(MAJOR_VERSION)_$(MINOR_VERSION)_$(PATCH_VERSION)
TARGET_JAR=messageapi-core-$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION).jar
JAR_INSTALL_SCRIPT=$(PROJECT_ROOT)/scripts/install/java/main/install.sh
......
plugins {
id 'groovy'
id 'maven-publish'
id 'java'
id 'com.github.johnrengelman.shadow' version '5.2.0'
}
shadowJar {
baseName = 'messageapi'
classifier = 'all'
version = "${messageApiVersion}"
manifest {
attributes 'Implementation-Title': 'messageapi-all',
'Implementation-Version': "${messageApiVersion}"
}
}
publishing {
publications {
maven(MavenPublication) {
groupId 'gov.noaa'
artifactId 'messageapi'
version "${messageApiVersion}"
from components.java
}
shadow(MavenPublication) { publication ->
groupId 'gov.noaa'
artifactId 'messageapi'
version "${messageApiVersion}"
project.shadow.component(publication)
}
}
repositories {
mavenLocal()
}
}
sourceCompatibility = "${javaVersion}"
targetCompatibility = "${javaVersion}"
defaultTasks 'clean', 'rebuild', 'uploadShadow', 'publishToMavenLocal', 'groovydoc'
defaultTasks 'clean', 'rebuild', 'groovydoc'
configurations {
// configuration that holds jars to include in the jar
directDeps
jarContents
}
repositories {
......@@ -54,13 +18,18 @@ repositories {
}
dependencies {
directDeps ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}")
compile ("commons-net:commons-net:${apacheCommonsNetVersion}",
jarContents ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}")
compile ("com.googlecode.json-simple:json-simple:${jsonSimpleVersion}",
"commons-net:commons-net:${apacheCommonsNetVersion}",
"org.codehaus.groovy:groovy-all:${groovyVersion}")
testCompile ("org.slf4j:slf4j-simple:${slf4jVersion}",
"org.spockframework:spock-core:${spockVersion}")
testRuntime ("com.athaydes:spock-reports:${spockReportsVersion}")
configurations.compile.extendsFrom(configurations.directDeps)
}
configurations.jarContents {
exclude group: 'org.hamcrest'
exclude group: 'junit'
}
jar {
......@@ -68,11 +37,11 @@ jar {
attributes 'Implementation-Title': 'MessageAPI',
'Implementation-Version': "${messageApiVersion}"
}
/*from {
configurations.directDeps.collect {
it.isDirectory() && it.getPath().contains("json-simple") ? it : project.logger.lifecycle(it.getPath())
from {
configurations.jarContents.collect {
it.isDirectory() ? it : zipTree(it)
}
}*/
}
}
sourceSets {
......
#Dockerfile for RHEL7 MessageAPI Build on UBI (Openshift Compatible)
#This dockerfile installs the system so that it will deploy the core artifacts,
#install jupyter notebooks, and install demo libraries for giving live demonstrations.
#Work in progress.
#Base Image (RHEL7 UBI)
FROM registry.access.redhat.com/ubi7/ubi:latest
#Install standard RHEL7 tools
#RUN yum -y install --disableplugin=subscription-manager \
# locate vim unzip wget git java-11-openjdk-devel gcc gcc-gfortran gcc-c++ make \
# && yum --disableplugin=subscription-manager clean all
#Install Java Variables
RUN cd $(dirname $(readlink -f $(which java))) && cd .. \
&& export JAVA_HOME=$PWD \
&& touch /etc/profile.d/java.sh \
&& echo "export JAVA_HOME=${JAVA_HOME}" > /etc/profile.d/java.sh \
&& echo "export PATH=${JAVA_HOME}/bin:$PATH" >> /etc/profile.d/java.sh \
&& echo "export CLASSPATH=${JAVA_HOME}/bin:${CLASSPATH}" >> /etc/profile.d/java.sh
#Install Gradle and Variables
RUN wget https://services.gradle.org/distributions/gradle-5.4.1-bin.zip -P /tmp \
&& unzip -d /opt/gradle /tmp/gradle-*.zip \
&& export GRADLE_HOME=/opt/gradle/gradle-5.4.1 \
&& touch /etc/profile.d/gradle.sh \
&& echo "export GRADLE_HOME=${GRADLE_HOME}" > /etc/profile.d/gradle.sh \
&& echo "export PATH=${GRADLE_HOME}/bin:$PATH" >> /etc/profile.d/gradle.sh
#Add default type user 'messageapi'
RUN useradd messageapi
#Change to new 'messageapi' user
USER messageapi
#Set PATH and other user variables in bashrc
RUN cd $(dirname $(readlink -f $(which java))) && cd .. \
&& export JAVA_HOME=$PWD \
&& echo "PATH=${JAVA_HOME}/bin:\$PATH" >> ~/.bashrc \
&& export GRADLE_HOME=/opt/gradle/gradle-5.4.1 \
&& echo "PATH=${GRADLE_HOME}/bin:\$PATH" >> ~/.bashrc \
&& source ~/.bashrc
\ No newline at end of file
#Dockerfile for RHEL7 MessageAPI Build on UBI (Openshift Compatible)
#This dockerfile installs only prebuilt artifacts by replicating the instructions
#given to users within the core package readme.
#Base Image (RHEL7 UBI)
FROM registry.access.redhat.com/ubi7/ubi:latest
#Install wget and the openjdk (JRE)
#These are used for installing and running the core.
RUN yum -y install --disableplugin=subscription-manager \
wget java-11-openjdk \
&& yum --disableplugin=subscription-manager clean all
#Add default type user 'messageapi' for production code as non root
RUN useradd messageapi
#Change to new 'messageapi' user
USER messageapi
#Install the Java core
RUN wget https://k3.cicsnc.org/rberkheimer/messageapi/-/raw/mac-develop/scripts/install/package/install_k3.sh?inline=false \
--no-check-certificate -O install_k3.sh \
&& chmod +x install_k3.sh \
&& ./install_k3.sh "C_CPP" \
&& rm install_k3.sh
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment