forked from medplum/medplum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-app.sh
executable file
·77 lines (64 loc) · 1.95 KB
/
deploy-app.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
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
if [[ -z "${APP_BUCKET}" ]]; then
echo "APP_BUCKET is missing"
exit 1
fi
pushd packages/app
# First deploy hashed files that are cached forever
# It is important to deploy these files first,
# because they are referenced by the index.html file.
# If a user attempts to download a hashed file that doesn't exist,
# it can cause a bad cache entry in CloudFront.
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "text/css" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.css"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "text/javascript" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.js"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "application/json" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.map"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "text/plain" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.txt"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "image/x-icon" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.ico"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "image/png" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.png"
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "image/svg+xml" \
--cache-control "public, max-age=31536000" \
--exclude "*" \
--include "*.svg"
# Now deploy named files that are not cached.
# These are small lightweight files that are not hashed.
# It is important to deploy these files last,
# because they reference the previously uploaded hashed files.
aws s3 cp dist/ "s3:https://${APP_BUCKET}/" \
--recursive \
--content-type "text/html" \
--cache-control "no-cache" \
--exclude "*" \
--include "*.html"
popd