-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate-replicas-local-deploy.sh
executable file
·39 lines (29 loc) · 1.71 KB
/
generate-replicas-local-deploy.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
#!/bin/bash
pushd "$(dirname "$(realpath "$0")")" || exit
>&2 echo "Generating shared volume directory in replicas-local-deploy"
mkdir -p replicas-local-deploy/store-cache || exit
if [[ ! -f config/application.properties ]] ; then
>&2 echo "Replicating config/application.properties.example to config/application.properties"
cp config/application.properties.example config/application.properties || exit
fi
>&2 echo "Regenerating Dockerfile and docker-compose.yml from your current working directory, UID, and GID: $(id -u):$(id -g)"
if [[ -f replicas-local-deploy/Dockerfile ]] ; then
rm replicas-local-deploy/Dockerfile || exit
fi
if [[ -f docker-compose.yml ]] ; then
rm docker-compose.yml || exit
fi
sed 's/##USER##/'"$(id -u)"'/g' replicas-local-deploy/Dockerfile.template > replicas-local-deploy/Dockerfile || exit
sed 's/##USER##/'"$(id -u)"'/g' replicas-local-deploy/Dockerfile.jvm.template > replicas-local-deploy/Dockerfile.jvm || exit
sed 's/##USER##/'"$(id -u)"'/g' replicas-local-deploy/docker-compose.yml.template > docker-compose.yml || exit
sed -i 's/##GROUP##/'"$(id -g)"'/g' docker-compose.yml || exit
sed -i 's|##ABS_PATH##|'"$(pwd)"'|g' docker-compose.yml || exit
>&2 echo "docker-compose.yml is now generated in $(pwd)"
>&2 echo "Generating java nativeapp and docker image"
./mvnw package -Pnative -Dquarkus.native.container-build=true || exit
docker build -f replicas-local-deploy/Dockerfile -t quarkus/tts-rest-wrapper . || exit
>&2 echo "Generating java JVM-app and docker image"
./mvnw package || exit
docker build -f replicas-local-deploy/Dockerfile.jvm -t quarkus/tts-rest-wrapper-jvm . || exit
>&2 echo "Now you can execute 'docker-compose up --scale tts-service=<N> [--other-options]'"
>&2 popd || exit