forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# To Know Git version | ||
git --version | ||
|
||
# To Know Docker version | ||
docker --version | ||
|
||
# To Run Gradale Build need to have Java Vesion 1.11.+ | ||
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 | ||
|
||
# Setting JAVA_HOME to System PATH | ||
export PATH=$PATH:$JAVA_HOME | ||
|
||
# Get the Shorter format of Git-SHA | ||
export GITHASH=`git rev-parse --short HEAD` | ||
|
||
# Get the BUILD Date | ||
export BUILDDATE=`date -u +"%Y%m%d%H%M"` | ||
|
||
# For Assiging the Gradle Resources | ||
export GRADLE_OPTS="-Xmx6g -Xms6g" | ||
|
||
# The Current Build ID | ||
echo "Build id is --------------------- $BUILD_ID" | ||
|
||
# To make Compatable to Ubi8 Build | ||
cp docker/ubi8/setupapache2.sh docker/setup-apache2.sh | ||
cp docker/ubi8/runapache2.sh docker/run-apache2.sh | ||
|
||
# To remove Special characters | ||
sed -i 's/\r//' docker/setup-apache2.sh | ||
sed -i 's/\r//' docker/run-apache2.sh | ||
|
||
# Assigning Rhel Image Name according to Quay.io Details | ||
IMAGENAME="quay.io/opsmxpublic/ubi8-oes-deck:${GITHASH}-${BUILD_NUMBER}" | ||
|
||
# Assigning Rhel Image Name according to Docker.io Details | ||
RELEASE_IMAGENAME="opsmx11/ubi8-oes-deck:${GITHASH}-${BUILD_NUMBER}" | ||
|
||
# Gradle command to Produce the Dependant targetfiles for Docker build | ||
./gradlew build --no-daemon -PskipTests | ||
|
||
# To Build Docker image with Given Docker File | ||
docker build -t $IMAGENAME -t $RELEASE_IMAGENAME . -f ${DOCKERFILE_PATH} --no-cache | ||
|
||
# Quay.io login | ||
docker login -u $quay_user -p $quay_pass quay.io | ||
|
||
# To Push the Docker image into Quay.io | ||
docker push $IMAGENAME | ||
|
||
# Docker.io login | ||
docker login -u $docker_user -p $docker_pass docker.io | ||
|
||
# To Push the Docker image into Quay.io | ||
docker push $RELEASE_IMAGENAME | ||
|
||
echo "Deck: ${IMAGENAME}" | ||
|
||
# Quay Image Name as Artifact | ||
echo \"Quay_IMAGE_NAME\": \"${IMAGENAME}\" > file.properties; |