-
Notifications
You must be signed in to change notification settings - Fork 141
/
deploy.sh
63 lines (50 loc) · 1.66 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e
echo "--------------------------"
echo " _____ _ _ "
echo " / ____| | | | |"
echo "| | __ ___ _ __ | | | |"
echo "| | |_ |/ _ \ '_ \| | | |"
echo "| |__| | __/ | | | |__| |"
echo " \_____|\___|_| |_|\____/ "
echo "--------------------------"
# コマンド引数の処理
while [[ $# -gt 0 ]]; do
case "$1" in
-c|--cdk-context)
cdk_context_path="$2"
shift 2
;;
-h|--help)
echo "-c, --cdk-context ... Path to the cdk.json file"
echo "-h, --help ... Show this message"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
pushd /tmp
# /tmp に存在するリポジトリを念の為削除
rm -rf generative-ai-use-cases-jp
# GenU を clone
git clone https://github.com/aws-samples/generative-ai-use-cases-jp
pushd generative-ai-use-cases-jp
# npm パッケージのインストール
npm ci
# cdk.json が指定されている場合は上書きする
if [[ -n "$cdk_context_path" ]]; then
echo "Overwrite the cdk.json by $cdk_context_path"
cp -f $cdk_context_path packages/cdk/cdk.json
fi
# CDK の bootstrap
npx -w packages/cdk cdk bootstrap
# デプロイの実行
npm run cdk:deploy
# デプロイした CloudFront の url を取得
weburl=`aws cloudformation describe-stacks --stack-name GenerativeAiUseCasesStack --output json | jq -r ".Stacks[0].Outputs[] | select(.OutputKey==\"WebUrl\") | .OutputValue"`
echo "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
echo "Welcome to GenU: $weburl"
echo "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"