-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·65 lines (47 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Author: Didier DONSEZ
# License ASL 2.0
# Build script for the Wildfly container containing javaee7-angular simple web app and swagger UI
COMPONENT_VERSION="1.0"
COMPONENT_NAME="wildfly-app"
COMPONENT_INSTANCE=1
# DOCKERFILE=${COMPONENT_NAME}.df
DOCKERFILE=Dockerfile
WORKDIR=$(pwd)
wait_for_host_port(){
echo "Wait for $1:$2 ..."
until nc -vzw 2 $1 $2 &>/dev/null;
do
echo "Wait for $1:$2"
sleep 1
done
echo "$1:$2 ready"
}
# Install Docker
# TODO
# Install Java and Maven
# TODO
# Get javaee7-angular
cd /tmp
git clone https://github.com/radcortez/javaee7-angular.git
cd javaee7-angular
mvn clean install
# Get swagger-ui
cd /tmp
git clone https://github.com/swagger-api/swagger-ui.git
cd swagger-ui
cd $WORKDIR
cp /tmp/javaee7-angular/target/javaee7-angular.war .
mkdir swagger-ui
cp -r /tmp/swagger-ui/dist/* swagger-ui/
docker pull jboss/wildfly
docker build -t ${COMPONENT_NAME}-${COMPONENT_INSTANCE}:${COMPONENT_VERSION} -f $DOCKERFILE .
docker run --hostname ${COMPONENT_NAME}-${COMPONENT_INSTANCE} --name ${COMPONENT_NAME}-${COMPONENT_INSTANCE} -p 8080:8080 -p 9990:9990 -d ${COMPONENT_NAME}-${COMPONENT_INSTANCE}:${COMPONENT_VERSION}
# Open URLs
wait_for_host_port localhost 8080
open http://localhost:8080/
open http://localhost:8080/javaee7-angular
# wait_for_host_port localhost 8443
open https://localhost:8443/javaee7-angular
# wait_for_host_port localhost 9990
open http://localhost:9990/management