-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
executable file
·49 lines (33 loc) · 890 Bytes
/
entrypoint.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
#!/bin/sh
set -e
if [ -z "$AWS_S3_BUCKET" ]; then
echo "AWS_S3_BUCKET is not set. Quitting."
exit 1
fi
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "AWS_ACCESS_KEY_ID is not set. Quitting."
exit 1
fi
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
echo "AWS_SECRET_ACCESS_KEY is not set. Quitting."
exit 1
fi
if [ -z "$AWS_DEFAULT_REGION" ]; then
echo "AWS_DEFAULT_REGION is not set. Quitting."
exit 1
fi
mkdir -p ~/.aws
touch ~/.aws/credentials
echo "[default]
aws_access_key_id = ${AWS_ACCESS_KEY_ID}
aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/credentials
echo "Install yarn"
npm install -g yarn
echo "Install dependencies"
yarn install
echo "Run yarn build"
yarn run build
echo "Copying to website folder"
aws s3 sync ./build s3://${AWS_S3_BUCKET} --exact-timestamps --delete --region ${AWS_DEFAULT_REGION} $*
echo "Cleaning up things"
rm -rf ~/.aws