forked from PhilippSalvisberg/docker-odb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·49 lines (36 loc) · 1.43 KB
/
build.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
#!/bin/bash
BUILD_START=$(date '+%s')
CONTAINER_NAME="juxta-oracle-build-${BUILD_START}"
if [ ! "$(docker ps -q -f name=${CONTAINER_NAME})" ]; then
if [ "$(docker ps -aq -f status=exited -f name=${CONTAINER_NAME})" ]; then
# cleanup
docker rm ${CONTAINER_NAME}
fi
#Uncomment for full build
#source buildDockerImage.sh
echo "Running Oracle Database 11gR2 Standard Edition in a Docker container"
docker run -d --name ${CONTAINER_NAME} -e ORACLE_PWD=juxta -v ${PWD}/scripts/setup:/opt/oracle/scripts/setup juxta/oracle:11.2.0.4-se
fi
CONTAINER_STATUS=""
while [ "$CONTAINER_STATUS" = "" ]
do CONTAINER_STATUS=`docker logs ${CONTAINER_NAME} 2>&1 | grep 'DATABASE IS READY TO USE!\|DATABASE SETUP WAS NOT SUCCESSFUL!'`
done
#display docker full logs
docker logs ${CONTAINER_NAME}
if [ "$CONTAINER_STATUS" = "DATABASE SETUP WAS NOT SUCCESSFUL!" ]
then
echo "$CONTAINER_STATUS"
docker rm -f ${CONTAINER_NAME}
exit 1
fi
echo "Commit the container"
docker commit --author "Eric Clement <[email protected]>" --message "Empty snapshot" ${CONTAINER_NAME} juxta/oracle:latest
echo "Push image to regisry (jxt-dev-pgsql.juxta.fr:5000/oracle)"
docker tag juxta/oracle jxt-dev-pgsql.juxta.fr:5000/oracle
docker push jxt-dev-pgsql.juxta.fr:5000/oracle
docker rm -f ${CONTAINER_NAME}
BUILD_END=$(date '+%s')
BUILD_ELAPSED=`expr $BUILD_END - $BUILD_START`
echo ""
echo "Build completed in $BUILD_ELAPSED seconds."
exit 0