1212usage () {
1313cat << EOF
1414
15- Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s]
15+ Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s] [-c]
1616Builds a Docker Image for Oracle WebLogic.
1717
1818Parameters:
@@ -21,6 +21,7 @@ Parameters:
2121 -d: creates image based on 'developer' distribution
2222 -g: creates image based on 'generic' distribution
2323 -i: creates image based on 'infrastructure' distribution
24+ -c: enables Docker image layer cache during build
2425 -s: skips the MD5 check of packages
2526
2627* select one distribution only: -d, -g, or -i
@@ -52,7 +53,8 @@ GENERIC=0
5253INFRASTRUCTURE=0
5354VERSION=" 12.2.1"
5455SKIPMD5=0
55- while getopts " hsdgiv:" optname; do
56+ NOCACHE=true
57+ while getopts " hcsdgiv:" optname; do
5658 case " $optname " in
5759 " h" )
5860 usage
@@ -72,6 +74,9 @@ while getopts "hsdgiv:" optname; do
7274 " v" )
7375 VERSION=" $OPTARG "
7476 ;;
77+ " c" )
78+ NOCACHE=false
79+ ;;
7580 * )
7681 # Should not occur
7782 echo " Unknown error while processing options inside buildDockerImage.sh"
@@ -136,7 +141,7 @@ echo "Building image '$IMAGE_NAME' ..."
136141
137142# BUILD THE IMAGE (replace all environment variables)
138143BUILD_START=$( date ' +%s' )
139- docker build --force-rm=true --no-cache=true $PROXY_SETTINGS -t $IMAGE_NAME -f Dockerfile.$DISTRIBUTION . || {
144+ docker build --force-rm=$NOCACHE --no-cache=$NOCACHE $PROXY_SETTINGS -t $IMAGE_NAME -f Dockerfile.$DISTRIBUTION . || {
140145 echo " There was an error building the image."
141146 exit 1
142147}
0 commit comments