-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
serve.sh
executable file
·32 lines (23 loc) · 1.19 KB
/
serve.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
#!/usr/bin/env bash
SITE_NAME=$(cat CNAME)
SITE_NAME=${SITE_NAME//[^a-zA-Z0-9-]/-}
CONATINER_NAME="build-$SITE_NAME"
PORT=$(cat dev.port)
PORT_LIVERELOAD=$(cat dev-livereload.port)
DOCKER_INSPECT_CHECK=$( docker inspect --format "{{.State.Status}}" $CONATINER_NAME )
open 'http://localhost:8105/'
# if DOCKER_INSPECT_CHECK is "running" then exec into the container
if [ "$DOCKER_INSPECT_CHECK" == "running" ]; then
echo "Shell into existing Docker container:"
docker exec -it $CONATINER_NAME bash --login
else
echo "Starting Docker container to run build server:"
docker run --name $CONATINER_NAME -it --rm -p ${PORT}:${PORT} -p ${PORT_LIVERELOAD}:${PORT_LIVERELOAD} -v ${PWD}:/build/source:rw aemdesign/java-buildpack:jdk11 bash --login /build/source/docker-serve.sh
fi
# if [[ "$DOCKER_INSPECT_CHECK" == "running"]]; then
# echo "Shell into existing Docker container:"
# docker exec -it $CONATINER_NAME bash --login
# else
# echo "Starting Docker container to run build server:"
# docker run --name $CONATINER_NAME -it --rm -p ${PORT}:${PORT} -p ${PORT_LIVERELOAD}:${PORT_LIVERELOAD} -v ${PWD}:/build/source:rw aemdesign/centos-java-buildpack bash --login /build/source/docker-serve.sh
# fi