Skip to content

Commit

Permalink
Docker build and push files
Browse files Browse the repository at this point in the history
  • Loading branch information
varshinidepuru committed Apr 10, 2023
1 parent d77263d commit b42e23d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Build-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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"

# Gradle command to Produce the Dependant targetfiles for Docker build
./gradlew --no-daemon igor-web:installDist -x test

# Assigning Rhel Image Name according to Quay.io Details
IMAGENAME="quay.io/opsmxpublic/ubi8-spin-igor:${GITHASH}-${BUILD_NUMBER}"

# Assigning Rhel Image Name according to Docker.io Details
RELEASE_IMAGENAME="opsmx11/ubi8-spin-igor:${GITHASH}-${BUILD_NUMBER}"

# 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 Docker.io
docker push $RELEASE_IMAGENAME

echo "Igor: ${IMAGENAME}"

# Quay Image Name as Artifact
echo \"Igor\": \"${IMAGENAME}\" > file.properties;
11 changes: 11 additions & 0 deletions docker/ubi8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM registry.access.redhat.com/ubi8/ubi:8.3
MAINTAINER [email protected]
COPY igor-web/build/install/igor /opt/igor
RUN yum -y install java-11-openjdk-headless.x86_64 wget vim curl net-tools nettle
RUN yum -y update
RUN adduser spinnaker
RUN mkdir -p /opt/igor/plugins
RUN chmod -R 777 /opt/igor/plugins/
RUN chown -R spinnaker:spinnaker /opt/
USER spinnaker
CMD ["/opt/igor/bin/igor"]

0 comments on commit b42e23d

Please sign in to comment.