Skip to content

Commit 0874347

Browse files
committed
option to enable cache when building base image
1 parent 04cea42 commit 0874347

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

OracleWebLogic/dockerfiles/buildDockerImage.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
usage() {
1313
cat << EOF
1414
15-
Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s]
15+
Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s] [-c]
1616
Builds a Docker Image for Oracle WebLogic.
1717
1818
Parameters:
@@ -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
5253
INFRASTRUCTURE=0
5354
VERSION="12.2.1"
5455
SKIPMD5=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)
138143
BUILD_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

Comments
 (0)