-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·23 lines (18 loc) · 1.02 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
[ -L "$0" ] && SCRIPT_FILE=$(readlink -f "$0") && SCRIPT_DIR=$(dirname "$SCRIPT_FILE")
[ ! -L "$0" ] && SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) && SCRIPT_FILE="$SCRIPT_DIR/$(basename "$0")"
. "$SCRIPT_DIR/common.sh"
SQLPLUS_CONFIG_FILE="$SCRIPT_DIR/$SQLPLUS_CONFIG_FILE"
[ -f "$SQLPLUS_CONFIG_FILE" ] && . ${SQLPLUS_CONFIG_FILE}
LOCAL_TNS_ADMIN="${LOCAL_TNS_ADMIN:-$TNS_ADMIN}"
[ -z "$LOCAL_TNS_ADMIN" ] && echo "Please, specify 'LOCAL_TNS_ADMIN' parameter in '$SQLPLUS_CONFIG_FILE'" >&2 && exit 1
[ -z "$( docker images -q "$IMAGE_NAME:$IMAGE_TAG" )" ] \
&& echo "Docker image [$IMAGE_NAME:$IMAGE_TAG] not found; please, run command 'make build' first" >&2 && exit 1
SQLPLUS_RUN_FLAG_INTERACTIVE=${SQLPLUS_RUN_FLAG_INTERACTIVE:-"true"}
docker run $( [ "$SQLPLUS_RUN_FLAG_INTERACTIVE" = "true" ] && echo "-it" ) \
--rm \
--platform "$IMAGE_PLATFORM" \
-v "$(pwd)":/work \
-v "$LOCAL_TNS_ADMIN":/etc/oracle/instantclient/network/admin:Z,ro \
"$IMAGE_NAME:$IMAGE_TAG" \
sqlplus "$@"