Skip to content

Commit

Permalink
Fix example db script after oracle/docker-images master branch rename (
Browse files Browse the repository at this point in the history
…helidon-io#2858)

Signed-off-by: Daniel Kec <daniel.kec@oracle.com>
  • Loading branch information
danielkec authored and aseovic committed Apr 26, 2021
1 parent 387c989 commit 72dfa23
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions examples/messaging/docker/oracle-aq-18-xe/buildAndRun.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2020 Oracle and/or its affiliates.
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,8 +18,9 @@
CURR_DIR=$(pwd)
TEMP_DIR=../../target
IMAGES_DIR=${TEMP_DIR}/ora-images
IMAGES_ZIP_URL=https://github.com/oracle/docker-images/archive/master.zip
IMAGES_ZIP_DIR=docker-images-master/OracleDatabase/SingleInstance/dockerfiles
COMMIT="a69fe9b08ff147bb746d16af76cc5279ea5baf7a";
IMAGES_ZIP_URL=https://github.com/oracle/docker-images/archive/${COMMIT:0:7}.zip
IMAGES_ZIP_DIR=docker-images-${COMMIT}/OracleDatabase/SingleInstance/dockerfiles
ORA_DB_VERSION=18.4.0
BASE_IMAGE_NAME=oracle/database:${ORA_DB_VERSION}-xe
IMAGE_NAME=helidon/oracle-aq-example
Expand All @@ -33,25 +34,26 @@ if [[ "$(docker images -q ${BASE_IMAGE_NAME} 2>/dev/null)" == "" ]]; then
echo Base image ${BASE_IMAGE_NAME} not found. Building ...

# cleanup
mkdir -p ${TEMP_DIR}
rm -rf ${IMAGES_DIR}
rm ${TEMP_DIR}/ora-images.zip
rm -f ${TEMP_DIR}/ora-images.zip

# download official oracle docker images
curl -LJ -o ${TEMP_DIR}/ora-images.zip ${IMAGES_ZIP_URL}
# unzip only image for Oracle database 18.4.0
unzip -qq ${TEMP_DIR}/ora-images.zip "${IMAGES_ZIP_DIR}/*" -d ${IMAGES_DIR}
mv ${IMAGES_DIR}/${IMAGES_ZIP_DIR}/${ORA_DB_VERSION} ${IMAGES_DIR}/
mv ${IMAGES_DIR}/${IMAGES_ZIP_DIR}/buildDockerImage.sh ${IMAGES_DIR}/
mv ${IMAGES_DIR}/${IMAGES_ZIP_DIR}/buildContainerImage.sh ${IMAGES_DIR}/

# cleanup
rm -rf ${IMAGES_DIR}/docker-images-master
rm -rf ${IMAGES_DIR}/docker-images-${COMMIT}
rm ${TEMP_DIR}/ora-images.zip

# build base image
# can take long(15 minutes or so)
cd ${IMAGES_DIR} || exit
bash ./buildDockerImage.sh -v ${ORA_DB_VERSION} -x
cd "${CURR_DIR}" || exit
bash ./buildContainerImage.sh -v ${ORA_DB_VERSION} -x || exit
cd ${CURR_DIR} || exit
else
printf "OK\n"
fi
Expand All @@ -61,7 +63,7 @@ if [[ "$(docker images -q ${IMAGE_NAME} 2>/dev/null)" == "" ]]; then
printf "NOK\n"

echo Image ${IMAGE_NAME} not found. Building ...
docker build -t ${IMAGE_NAME} .
docker build -t ${IMAGE_NAME} . || exit
else
printf "OK\n"
fi
Expand All @@ -78,15 +80,15 @@ if [[ $(docker ps -a --filter "name=^/${CONTAINER_NAME}$" --format '{{.Names}}')
-p 1521:1521 \
-p 5500:5500 \
-e ORACLE_PWD=${ORACLE_PWD} \
${IMAGE_NAME}
${IMAGE_NAME} || exit
else
printf "OK\n"
printf "%-100s" "Checking if container ${CONTAINER_NAME} is started"
if [[ $(docker ps --filter "name=^/${CONTAINER_NAME}$" --format '{{.Names}}') != "${CONTAINER_NAME}" ]]; then
printf "NOK\n"

echo "Container ${CONTAINER_NAME} not started. Starting ..."
docker start ${CONTAINER_NAME}
docker start ${CONTAINER_NAME} || exit
else
printf "OK\n"
fi
Expand Down

0 comments on commit 72dfa23

Please sign in to comment.