Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash
#
# Since: November, 2018
#############################
# Copyright (c) 2025, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
# Author: paramdeep.saini@oracle.com
# Description: Build script for building DNS server container image
############################
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
Expand All @@ -17,7 +19,7 @@ It builds a container image for a DNS server

Parameters:
-v: version to build
Choose one of: $(for i in */; do echo -n "${i%%/} "; done)
Choose one of: $(printf "%s " */ | sed 's#/##g')
-o: passes on container build option

LICENSE UPL 1.0
Expand All @@ -28,23 +30,28 @@ EOF
exit 0
}

# Validate packages

checksumPackages() {
if hash md5sum 2>/dev/null; then
if [ "$SKIPMD5" -eq 1 ]; then
echo "Skipping MD5 checksum verification."
return 0
fi

if command -v md5sum >/dev/null 2>&1; then
echo "Checking if required packages are present and valid..."
md5sum -c Checksum
md5_exit_code=$?

if [ "$md5_exit_code" -ne 0 ]; then
echo "MD5 for required packages to build this image did not match!"
echo "Make sure to download missing files in folder $VERSION."
exit "$md5_exit_code"
rc=$?
if [ "$rc" -ne 0 ]; then
echo "MD5 for required packages to build this image did not match!"
echo "Make sure to download missing files in folder $VERSION."
exit "$rc"
fi
else
echo "Ignored MD5 sum, 'md5sum' command not available."
fi
}


##############
#### MAIN ####
##############
Expand All @@ -55,27 +62,30 @@ fi

# Parameters
VERSION="latest"
DOCKEROPS=("${DOCKEROPS[@]}")
PROXY_SETTINGS=("${PROXY_SETTINGS[@]}")
SKIPMD5=0
DOCKEROPS=""

while getopts "h:v:o:" optname; do
while getopts "hiv:o:" optname; do
case "$optname" in
"h")
usage
;;
"i")
SKIPMD5=1
;;
"v")
VERSION="$OPTARG"
;;
"o")
DOCKEROPS=("$OPTARG")
DOCKEROPS="$OPTARG"
;;
"?")
usage
usage;
# shellcheck disable=SC2317
exit 1
exit 1;
;;
*)
# Should not occur
# Should not occur
echo "Unknown error while processing options inside buildDockerImage.sh"
;;
esac
Expand All @@ -87,30 +97,30 @@ IMAGE_NAME="oracle/rac-dnsserver:$VERSION"
# Go into version folder
cd "$VERSION" || exit


echo "=========================="
echo "DOCKER info:"
docker info
echo "=========================="

# Proxy settings
if [ -n "${http_proxy-}" ]; then
PROXY_SETTINGS+=("--build-arg http_proxy=${http_proxy}")
PROXY_SETTINGS=""
if [ "${http_proxy}" != "" ]; then
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg http_proxy=${http_proxy}"
fi

if [ -n "${https_proxy-}" ]; then
PROXY_SETTINGS+=("--build-arg https_proxy=${https_proxy}")
if [ "${https_proxy}" != "" ]; then
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg https_proxy=${https_proxy}"
fi

if [ -n "${ftp_proxy-}" ]; then
PROXY_SETTINGS+=("--build-arg ftp_proxy=${ftp_proxy}")
if [ "${ftp_proxy}" != "" ]; then
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg ftp_proxy=${ftp_proxy}"
fi

if [ -n "${no_proxy-}" ]; then
PROXY_SETTINGS+=("--build-arg no_proxy=${no_proxy}")
if [ "${no_proxy}" != "" ]; then
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg no_proxy=${no_proxy}"
fi
# shellcheck disable=SC2128
if [ -n "$PROXY_SETTINGS" ]; then

if [ "$PROXY_SETTINGS" != "" ]; then
echo "Proxy settings were found and will be used during the build."
fi

Expand All @@ -120,20 +130,24 @@ fi
echo "Building image '$IMAGE_NAME' ..."

# BUILD THE IMAGE (replace all environment variables)
BUILD_START=$(date '+%s')
if docker build --force-rm=true --no-cache=true "${DOCKEROPS[@]}" "${PROXY_SETTINGS[@]}" -t "$IMAGE_NAME" -f Containerfile .; then
BUILD_END=$(date '+%s')
BUILD_ELAPSED=$((BUILD_END - BUILD_START))

cat << EOF
Oracle Database Docker Image for Real Application Clusters (RAC) version $VERSION is ready to be extended:

--> $IMAGE_NAME
BUILD_START=$(date +%s)

Build completed in $BUILD_ELAPSED seconds.

EOF
else
if ! docker build --force-rm=true --no-cache=true \
$DOCKEROPS $PROXY_SETTINGS \
-t "$IMAGE_NAME" -f Containerfile .; then
echo "There was an error building the image."
exit 1
fi
fi

BUILD_END=$(date +%s)
BUILD_ELAPSED=$((BUILD_END - BUILD_START))

cat << EOF

Oracle Database Docker Image for Real Application Clusters (RAC) version $VERSION is ready to be extended:

--> $IMAGE_NAME

Build completed in $BUILD_ELAPSED seconds.

EOF
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Oracle Licensing for this image is governed by the License Agreement, which must be accepted on the Oracle Container Registry (https://container-registry.oracle.com/ ).
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,10 @@ def get_sw_cmd(self, key, rspfile, node, netmasklist):
if int(version) == 19:
distid_env = "export CV_ASSUME_DISTID=OL8; "
if self.check_key("CRS_GPC", self.ora_env_dict):
cmd = f'''su - {giuser} -c "{distid_env}{gihome}/{runCmd} -waitforcompletion {copyflag} -silent -responseFile {rspfile} {pwdparam} {prereq} {prereqfailure}"'''
if int(version) <= 21:
cmd = f'''su - {giuser} -c "{distid_env}{gihome}/{runCmd} -waitforcompletion {copyflag} -silent -responseFile {rspfile} {prereq} {prereqfailure}"'''
else:
cmd = f'''su - {giuser} -c "{distid_env}{gihome}/{runCmd} -waitforcompletion {copyflag} -silent -responseFile {rspfile} {pwdparam} {prereq} {prereqfailure}"'''
else:
param1 = f'''oracle.install.crs.config.netmaskList={netmasklist}''' if netmasklist else \
'''oracle.install.crs.config.netmaskList=eth0:255.255.0.0,eth1:255.255.255.0,eth2:255.255.255.0'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,59 +382,50 @@ def prepare_responsefile(self):
asmstr, disksWithFGNames, oraversion, gridrsp, netmasklist, clusterusage
)

def get_responsefile(self, obase, invloc, scanname, scanport, clutype, cluname, clunodes, nwiface, gimrflag, passwd, dgname, dgred, fgname, asmdisk, asmstr, disksWithFGNames, oraversion, gridrsp, netmasklist, crsconfig):
"""
This function prepares the response file if no response file is passed.
"""
self.ocommon.log_info_message("I am in get_responsefile", self.file_name)

rspdata = '''
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v{15}
oracle.install.option={19}
ORACLE_BASE={0}
INVENTORY_LOCATION={1}
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName={2}
oracle.install.crs.config.gpnp.scanPort={3}
oracle.install.crs.config.clusterName={5}
oracle.install.crs.config.clusterNodes={6}
oracle.install.crs.config.networkInterfaceList={7}
oracle.install.crs.configureGIMR={8}
oracle.install.asm.SYSASMPassword=
oracle.install.asm.monitorPassword=
oracle.install.crs.config.storageOption=
oracle.install.asm.diskGroup.name={10}
oracle.install.asm.diskGroup.redundancy={11}
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.diskGroup.disksWithFailureGroupNames={18}
oracle.install.asm.diskGroup.disks={13}
oracle.install.asm.diskGroup.quorumFailureGroupNames=
oracle.install.asm.diskGroup.diskDiscoveryString={14}
oracle.install.crs.rootconfig.configMethod=ROOT
oracle.install.asm.configureAFD=false
oracle.install.crs.rootconfig.executeRootScript=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.crs.configureRHPS={16}
oracle.install.crs.config.ClusterConfiguration={17}
'''.format(
obase, invloc, scanname, scanport, clutype, cluname, clunodes,
nwiface, gimrflag, passwd, dgname, dgred, fgname, asmdisk, asmstr,
oraversion, "false", "STANDALONE", disksWithFGNames, crsconfig
)

self.ocommon.write_file(gridrsp, rspdata)
if os.path.isfile(gridrsp):
return gridrsp, netmasklist
else:
self.ocommon.log_error_message(
"Grid response file does not exist at its location: " + gridrsp + ". Exiting..",
self.file_name
)
self.ocommon.prog_exit("127")

def get_responsefile(self,obase,invloc,scanname,scanport,clutype,cluname,clunodes,nwiface,gimrflag,passwd,dgname,dgred,fgname,asmdisk,asmstr,disksWithFGNames,oraversion,gridrsp,netmasklist,crsconfig):
"""
This function prepare the response file if no response file passed
"""
self.ocommon.log_info_message("I am in get_responsefile", self.file_name)
rspdata='''
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v{15}
oracle.install.option={19}
ORACLE_BASE={0}
INVENTORY_LOCATION={1}
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName={2}
oracle.install.crs.config.gpnp.scanPort={3}
oracle.install.crs.config.clusterName={5}
oracle.install.crs.config.clusterNodes={6}
oracle.install.crs.config.networkInterfaceList={7}
oracle.install.crs.configureGIMR={8}
oracle.install.asm.SYSASMPassword={9}
oracle.install.asm.monitorPassword={9}
oracle.install.crs.config.storageOption=
oracle.install.asm.diskGroup.name={10}
oracle.install.asm.diskGroup.redundancy={11}
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.diskGroup.disksWithFailureGroupNames={18}
oracle.install.asm.diskGroup.disks={13}
oracle.install.asm.diskGroup.quorumFailureGroupNames=
oracle.install.asm.diskGroup.diskDiscoveryString={14}
oracle.install.crs.rootconfig.configMethod=ROOT
oracle.install.asm.configureAFD=false
oracle.install.crs.rootconfig.executeRootScript=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.crs.configureRHPS={16}
oracle.install.crs.config.ClusterConfiguration={17}
'''.format(obase,invloc,scanname,scanport,clutype,cluname,clunodes,nwiface,gimrflag,passwd,dgname,dgred,fgname,asmdisk,asmstr,oraversion,"false","STANDALONE",disksWithFGNames,crsconfig)
# fdata="\n".join([s for s in rspdata.split("\n") if s])
self.ocommon.write_file(gridrsp,rspdata)
if os.path.isfile(gridrsp):
return gridrsp,netmasklist
else:
self.ocommon.log_error_message("Grid response file does not exist at its location: " + gridrsp + ".Exiting..",self.file_name)
self.ocommon.prog_exit("127")

def get_23c_responsefile(self,obase,invloc,scanname,scanport,clutype,cluname,clunodes,nwiface,gimrflag,passwd,dgname,dgred,fgname,asmdisk,asmstr,disksWithFGNames,oraversion,gridrsp,netmasklist,clusterusage):
"""
Expand Down
Loading