diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/assembly/descriptor.xml | 36 | ||||
-rw-r--r-- | src/main/bin/start.sh | 11 | ||||
-rw-r--r-- | src/main/docker/Dockerfile | 24 |
3 files changed, 50 insertions, 21 deletions
diff --git a/src/main/assembly/descriptor.xml b/src/main/assembly/descriptor.xml new file mode 100644 index 0000000..1d88931 --- /dev/null +++ b/src/main/assembly/descriptor.xml @@ -0,0 +1,36 @@ +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>build</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>logback.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/bin</directory>
+ <outputDirectory>/bin</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ <excludes>
+ <exclude>Dockerfile</exclude>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh index 038f4df..1dedb25 100644 --- a/src/main/bin/start.sh +++ b/src/main/bin/start.sh @@ -20,6 +20,13 @@ # ============LICENSE_END============================================ #******************************************************************************* +# jre-alpine image has $JAVA_HOME set and added to $PATH +# ubuntu image requires to set $JAVA_HOME and add java to $PATH manually +if ( uname -v | grep -i "ubuntu" ); then + export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-`dpkg --print-architecture | awk -F- '{ print $NF }'` + export PATH=${JAVA_HOME}:$PATH +fi + # AJSC_HOME is required for EELF logging. # This path is referenced in the file logback.xml. AJSC_HOME="${AJSC_HOME-/opt/app/model-loader}" @@ -30,8 +37,6 @@ if [ -z "$CONFIG_HOME" ]; then exit 1 fi -JARFILE="$AJSC_HOME/model-loader.jar" - # Some properties are repeated here for debugging purposes. PROPS="-DAJSC_HOME=$AJSC_HOME" PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME" @@ -52,5 +57,7 @@ if [ -z "${java_runtime_arguments}" ]; then -Djava.rmi.server.hostname=127.0.0.1" fi +JARFILE=$(ls ./model-loader*.jar); + echo "java $java_runtime_arguments $PROPS -jar $JARFILE" java $java_runtime_arguments $PROPS -jar $JARFILE diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index db67dd9..a523778 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -1,26 +1,12 @@ -FROM ubuntu:14.04 +FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@ ARG MICRO_HOME=/opt/app/model-loader -ARG BIN_HOME=$MICRO_HOME/bin -ARG JAR_FILE=model-loader.jar - -RUN apt-get update - -# Install and setup java8 -RUN apt-get update && apt-get install -y software-properties-common -## sudo -E is required to preserve the environment. If you remove that line, it will most likely freeze at this step -RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk -## Set up JAVA_HOME for docker command-line -ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-amd64 -RUN export JAVA_HOME # Build up the deployment folder structure RUN mkdir -p $MICRO_HOME -COPY ${JAR_FILE} $MICRO_HOME/ -COPY classes/logback.xml $MICRO_HOME/ -RUN mkdir -p $BIN_HOME -COPY *.sh $BIN_HOME -RUN chmod 755 $BIN_HOME/* -RUN ln -s /logs $MICRO_HOME/logs +WORKDIR $MICRO_HOME +COPY /maven/model-loader/ . +RUN chmod 755 bin/* \ + && ln -s /logs $MICRO_HOME/logs CMD ["/opt/app/model-loader/bin/start.sh"] |