-
Notifications
You must be signed in to change notification settings - Fork 7
/
push_java_app_with_binary_sidecar.sh
executable file
·47 lines (39 loc) · 1.23 KB
/
push_java_app_with_binary_sidecar.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
_#!/usr/bin/env bash
set -e
APP_NAME="sidecar-dependent-java-app"
JAVA_APP_PATH="sidecar-dependent-java-app"
JAVA_APP_MANIFEST_PATH="manifest.yml"
JAVA_APP_JAR="build/libs/sidecar-dependent-java-app-0.0.1-SNAPSHOT.jar"
CONFIG_SERVER_SIDECAR_PATH="config-server-sidecar"
function clean() {
cf delete -f "${APP_NAME}"
rm "${CONFIG_SERVER_SIDECAR_PATH}/config-server"
pushd ${JAVA_APP_PATH} > /dev/null
./gradlew clean
popd > /dev/null
}
function build_config_server() {
pushd ${CONFIG_SERVER_SIDECAR_PATH} > /dev/null
GOOS=linux GOARCH=amd64 go build -o config-server .
popd > /dev/null
}
function build_java_app() {
pushd ${JAVA_APP_PATH} > /dev/null
./gradlew build
popd > /dev/null
}
function push_java_app_with_sidecars() {
zip "${JAVA_APP_PATH}/${JAVA_APP_JAR}" -u "${CONFIG_SERVER_SIDECAR_PATH}/config-server"
cf v3-create-app "${APP_NAME}"
cf v3-apply-manifest -f "${JAVA_APP_PATH}/${JAVA_APP_MANIFEST_PATH}"
cf v3-push "${APP_NAME}" \
-p "${JAVA_APP_PATH}/build/libs/sidecar-dependent-java-app-0.0.1-SNAPSHOT.jar" \
-b java_buildpack
}
function main() {
clean
build_config_server
build_java_app
push_java_app_with_sidecars
}
main