Skip to content

Commit d5ebb70

Browse files
committed
Make the script more flexible
Signed-off-by: doxiao <[email protected]>
1 parent da31c1c commit d5ebb70

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The script will perform the following steps:
2828
* Create a properties file, `domain.properties`, in the directory that is created above. This properties file will be used to create a sample WebLogic Server domain.
2929
* Clone the weblogic docker-images project via the `git clone https://github.com/oracle/docker-images.git` into the current directory.
3030
* Replace the built-in username and password in the `properties/docker_build/domain_security.properties` file with the `username` and `password` that are supplied in the command line via the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
31-
* Build a Docker image based on the Docker sample, [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image). It will create a sample WebLogic Server domain in the Docker image. Also, you can run the Docker sample, [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image), manually with the generated `domain.properties` to create a domain home image. **Note**: Oracle recommends keeping the domain home image private in the local repository.
31+
* Build a Docker image based on the Docker sample, [Example Image with a WebLogic Server Domain using WebLogic Deploy Tooling](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image-wdt) and [Example Image with a WebLogic Server Domain using WLST](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image). It will create a sample WebLogic Server domain in the Docker image. Also, you can run the Docker sample, [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image), manually with the generated `domain.properties` to create a domain home image. **Note**: Oracle recommends keeping the domain home image private in the local repository.
3232
* Create a Kubernetes domain YAML file, `domain.yaml`, in the directory that is created above. This YAML file can be used to create the Kubernetes resource using the `kubectl create -f` or `kubectl apply -f` command.
3333

3434
As a convenience, using the `-e` option, the script can optionally create the domain object, which in turn results in the creation of the corresponding WebLogic Server pods and services.

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,16 @@ function createDomainHome {
235235
cp ${domainPropertiesOutput} ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_build
236236

237237
if [ -z $imagePath ]; then
238-
imagePath="12213-domain-home-in-image"
238+
imagePath="12213-domain-home-in-image-wdt"
239239
fi
240240

241241
cd docker-images/OracleWebLogic/samples/${imagePath}
242+
243+
# 12213-domain-home-in-image use one properties file for the credentials
242244
usernameFile="properties/docker_build/domain_security.properties"
243245
passwordFile="properties/docker_build/domain_security.properties"
244246

247+
# 12213-domain-home-in-image-wdt uses two properties files for the credentials
245248
if [ ! -f $usernameFile ]; then
246249
usernameFile="properties/docker-build/adminuser.properties"
247250
passwordFile="properties/docker-build/adminpass.properties"
@@ -250,19 +253,17 @@ function createDomainHome {
250253
sed -i -e "s|myuser|${username}|g" $usernameFile
251254
sed -i -e "s|mypassword1|${password}|g" $passwordFile
252255

256+
# use the existence of build-archive.sh file to determine if we need to download WDT
253257
if [ -f "build-archive.sh" ]; then
254258
sh ./build-archive.sh
255259
wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.14/weblogic-deploy.zip
256260
fi
257261

258-
chmod 777 . build.sh
259-
260-
sh ./build.sh
261262
if [ ! -z $baseImage ]; then
262-
sed -i -e "s|oracle/weblogic:12.2.1.3-developer|${baseImage}|g" Dockerfile
263+
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" Dockerfile
263264
fi
264265

265-
./build.sh
266+
sh ./build.sh
266267

267268
if [ "$?" != "0" ]; then
268269
fail "Create domain ${domainName} failed."

0 commit comments

Comments
 (0)