Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
switch to cas gradle overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasMisaghMoayyed committed May 5, 2019
1 parent 1043e77 commit 5d9d1d7
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 104 deletions.
19 changes: 2 additions & 17 deletions .travis.yml
Expand Up @@ -31,26 +31,11 @@ branches:
only:
- master
jdk:
- oraclejdk7
# - oraclejdk8
- oraclejdk11
cache:
directories:
- '$HOME/.gradle/caches'
env:
global:
- secure: "JlFTItSTHxmevCoX1fXWkXtQOqP8ERT5ndeYMc378acqZIWEpmoSQelP8unRjtU6sU/4dxdUWpEFLrbcNQsFuPsgzMLGSwuEcjbuSBGMgdAHXSl6+FfBWrCcde2WIfk+eYMm7mrhcySWMvtWss1kDOu+s8+HtRvnRCAsfz+77hs="
- secure: "iWPPLKSS3zBs2adqLPkMiHfCj2hSLyD5BoV3oodhR7Ne83Kpn1khRcEWFoHF3Ed11eSU+glNdPSzUpc8TzwTZGx5B3RU2Qp36hZFyjuzNWJARmoVPYMiEg3FFBQrUR75w+Tbtn6zPkiAk6nl0K5ewmY0/xixVdnTLXL5HjpE2rc="
- secure: "f3mDIZ8m6NYJXI8KvWD/sZRSeCCyIyfgPRy3Q6o9u9WyHZuYaJf95Ia0eJQ3gxUDS1TKL31Vk08dhFKrfIcKgifFPa2uQ2uyJkvGxlarMTQ+tpqsZYp4zAJgKc9r4xdZasvF2k4xqr+pl9AFjlpXB4jDD59XPXt3DcRABOYA9sM="
before_install:
- chmod -R 777 ./travis/init-travis-build.sh
- ./travis/init-travis-build.sh
- chmod -R 777 ./gradlew
install:
- ./gradlew clean
script:
- ./gradlew assemble --parallel -q -DskipJavadocs=true
after_success:
- chmod -R 777 ./travis/push-javadoc-to-gh-pages.sh
- ./travis/push-javadoc-to-gh-pages.sh
- chmod -R 777 ./travis/deploy-to-sonatype.sh
- ./travis/deploy-to-sonatype.sh
- ./gradlew clean assemble --parallel -q -DskipJavadocs=true
40 changes: 6 additions & 34 deletions Dockerfile
Expand Up @@ -10,9 +10,9 @@ RUN yum -y install wget tar unzip git \

# Download Azul Java, verify the hash, and install \
RUN set -x; \
java_version=8.0.172; \
zulu_version=8.30.0.1; \
java_hash=0a101a592a177c1c7bc63738d7bc2930; \
java_version=11.0.3; \
zulu_version=11.31.11-ca; \
java_hash=20218b15ae5ef1318aed1a3d5dde3219; \

cd / \
&& wget http://cdn.azul.com/zulu/bin/zulu$zulu_version-jdk$java_version-linux_x64.tar.gz \
Expand All @@ -21,55 +21,27 @@ RUN set -x; \
&& rm zulu$zulu_version-jdk$java_version-linux_x64.tar.gz \
&& ln -s /opt/zulu$zulu_version-jdk$java_version-linux_x64/jre/ /opt/jre-home;

RUN cd / \
&& wget http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip \
&& unzip ZuluJCEPolicies.zip \
&& mv -f ZuluJCEPolicies/*.jar /opt/jre-home/lib/security \
&& rm ZuluJCEPolicies.zip;


# Set up Oracle Java properties
# RUN set -x; \
# java_version=8u112; \
# java_bnumber=15; \
# java_semver=1.8.0_112; \
# java_hash=eb51dc02c1607be94249dc28b0223be3712b618ef72f48d3e2bfd2645db8b91a; \

# # Download Oracle Java, verify the hash, and install \
# cd / \
# && wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \
# http://download.oracle.com/otn-pub/java/jdk/$java_version-b$java_bnumber/server-jre-$java_version-linux-x64.tar.gz \
# && echo "$java_hash server-jre-$java_version-linux-x64.tar.gz" | sha256sum -c - \
# && tar -zxvf server-jre-$java_version-linux-x64.tar.gz -C /opt \
# && rm server-jre-$java_version-linux-x64.tar.gz \
# && ln -s /opt/jdk$java_semver/ /opt/jre-home;

# Download the CAS overlay project \
RUN cd / \
&& git clone --depth 1 --single-branch -b $cas_version https://github.com/apereo/cas-overlay-template.git cas-overlay \
&& mkdir -p /etc/cas \
&& mkdir -p cas-overlay/bin;

COPY thekeystore /etc/cas/
COPY bin/*.* cas-overlay/bin/
COPY bin/*.* cas-overlay/
COPY etc/cas/config/*.* /cas-overlay/etc/cas/config/
COPY etc/cas/services/*.* /cas-overlay/etc/cas/services/

RUN chmod -R 750 cas-overlay/bin \
&& chmod 750 cas-overlay/mvnw \
&& chmod 750 cas-overlay/build.sh \
RUN chmod 750 cas-overlay/gradlew \
&& chmod 750 /opt/jre-home/bin/java;

# Enable if you are using Oracle Java
# && chmod 750 /opt/jre-home/jre/bin/java;

EXPOSE 8080 8443

WORKDIR /cas-overlay

ENV JAVA_HOME /opt/jre-home
ENV PATH $PATH:$JAVA_HOME/bin:.

RUN ./mvnw clean package -T 10 && rm -rf /root/.m2
RUN ./gradlew clean build && rm -rf /root/.gradle

CMD ["/cas-overlay/bin/run-cas.sh"]
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -2,8 +2,7 @@

## Introduction

This repository hosts the [Docker](https://www.docker.com/) build configuration necessary to build a [CAS](https://github.com/apereo/cas) image.
See the `Dockerfile` for more info.
This repository hosts the [Docker](https://www.docker.com/) build configuration necessary to build a [CAS](https://github.com/apereo/cas) image. See the `Dockerfile` for more info.

## Versions

Expand Down
2 changes: 1 addition & 1 deletion bin/run-cas.sh
Expand Up @@ -4,4 +4,4 @@ export PATH=$PATH:$JAVA_HOME/bin:.
# echo "Use of this image/container constitutes acceptence of the Oracle Binary Code License Agreement for Java SE."
cd /cas-overlay/
echo -e "Executing build from directory:" && pwd
exec ./build.sh run
exec java -jar build/libs/cas.war
4 changes: 0 additions & 4 deletions build.gradle
Expand Up @@ -2,8 +2,4 @@ description = "Apereo Cenrtal Authentication Service"

allprojects {
apply plugin: 'java'
}

task wrapper(type: Wrapper, description: "Gradle's wrapper") {
gradleVersion = "2.10"
}
30 changes: 26 additions & 4 deletions build.sh
@@ -1,4 +1,9 @@
#!/bin/bash

GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
NORMAL=$(tput sgr0)

cas_version=$1

if [ $# -eq 0 ] || [ -z "$cas_version" ]
Expand All @@ -7,10 +12,27 @@ if [ $# -eq 0 ] || [ -z "$cas_version" ]
read -p "Provide a tag for the CAS image you are about to build (i.e. 5.0.0): " cas_version;
fi

image_tag="latest"
branch_name="master"

if [[ "${cas_version}" == *"master"* ]]; then
image_tag="latest"
branch_name="master"
else
image_tag="v${cas_version}"
branch_name="`echo "${cas_version}" | cut -d. -f1 -f2`"
fi

if [ ! -z "$cas_version" ]
then
echo "Build CAS docker image tagged as v$cas_version"
docker build --tag="apereo/cas:v$cas_version" --build-arg cas_version=$cas_version . && echo "Built CAS image successfully tagged as v$cas_version" && docker images "apereo/cas:v$cas_version"
else
echo "No image tag is provided."
echo "Building CAS docker image tagged as ${YELLOW}[$image_tag]${NORMAL} \
from branch ${YELLOW}[$branch_name]${NORMAL}"

docker build --tag="apereo/cas:$image_tag" --build-arg cas_version=$cas_version . && \
echo "Built CAS image successfully tagged as $image_tag" && \
docker images "apereo/cas:$image_tag"
exit 0
fi

echo "No CAS version is provided"
exit 1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
#Thu Nov 19 13:33:30 MST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip
88 changes: 58 additions & 30 deletions gradlew 100644 → 100755
@@ -1,25 +1,59 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# 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.
#

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +75,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +105,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down Expand Up @@ -150,11 +170,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
30 changes: 20 additions & 10 deletions gradlew.bat
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down

0 comments on commit 5d9d1d7

Please sign in to comment.