forked from fuzziebrain/docker-apex-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
02-run.sh
executable file
·58 lines (49 loc) · 2.01 KB
/
02-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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
CONTAINER_NAME=${1:-axer}
ENV_FILE=${2:-.env}
. $ENV_FILE
BASE_DIR=$(pwd -P)
DB_VERSION=${DB_VERSION:-18.4.0}
DB_EDITION=$(echo ${DB_EDITION:-xe} | tr '[:upper:]' '[:lower:]')
HOST_DATA_DIR=${CONTAINER_NAME}-oradata
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME:-bridge}
FILES_DIR=${FILES_DIR:-$BASE_DIR/files}
echo "##### Check if Docker network $DOCKER_NETWORK_NAME #####"
docker network inspect -f {{.Name}} $DOCKER_NETWORK_NAME || \
echo "##### Create Docker network $DOCKER_NETWORK_NAME #####"; \
docker network create $DOCKER_NETWORK_NAME
echo "##### Removing any previous containers #####"
docker rm -vf $CONTAINER_NAME
if [ ! -d "${HOST_DATA_DIR}" ] && ! [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then
mkdir $HOST_DATA_DIR
fi
echo "##### Changing file ownership. May require password to continue. #####"
if ! [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then
sudo -n chown 54321:54321 ${HOST_DATA_DIR} || chmod 777 ${HOST_DATA_DIR}
fi
echo "##### Creating container $CONTAINER_NAME #####"
if [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then
docker run -d --name $CONTAINER_NAME \
--network ${DOCKER_NETWORK_NAME} \
-p ${DOCKER_ORDS_PORT:-50080}:8080 \
-p ${DOCKER_EM_PORT:-55500}:5500 \
-p ${DOCKER_DB_PORT:-51521}:1521 \
--env-file $ENV_FILE \
--tmpfs /dev/shm:rw,exec,size=2G \
oracle/database:${DB_VERSION}-${DB_EDITION}
else
docker run -d --name $CONTAINER_NAME \
--network ${DOCKER_NETWORK_NAME} \
-p ${DOCKER_ORDS_PORT:-50080}:8080 \
-p ${DOCKER_EM_PORT:-55500}:5500 \
-p ${DOCKER_DB_PORT:-51521}:1521 \
--env-file $ENV_FILE \
-v $PWD/$HOST_DATA_DIR:/opt/oracle/oradata \
-v $PWD/scripts/setup:/opt/oracle/scripts/setup \
-v $PWD/scripts/startup:/opt/oracle/scripts/startup \
-v $FILES_DIR:/tmp/files \
--tmpfs /dev/shm:rw,exec,size=2G \
oracle/database:${DB_VERSION}-${DB_EDITION}
fi
echo "##### Tailing logs. Ctrl-C to exit. #####"
docker logs -f $CONTAINER_NAME