-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy_local_changes.sh
executable file
·51 lines (43 loc) · 1.1 KB
/
deploy_local_changes.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
#!/usr/bin/env bash
trap swap_back EXIT
function stderr {
>&2 echo "$@"
}
function help() {
stderr "This little script makes it easy to switch the Dockerfile and Dockerfile.direct files "
stderr "and deploy local UI changes to a personal deployment. "
stderr "The script requires a 'skaffold.yml' file to be present and set up to point to a personal deployment. "
}
function setup() {
stderr "Setting up backup files"
cp Dockerfile Dockerfile.bak
cp Dockerfile.direct Dockerfile.direct.bak
}
function swap_dockerfiles() {
stderr "Swapping Dockerfile and Dockerfile.direct"
mv Dockerfile.direct Dockerfile
}
function swap_back() {
stderr "Restoring Dockerfiles back to their original state"
cp Dockerfile.bak Dockerfile
cp Dockerfile.direct.bak Dockerfile.direct
}
function skaffold_deploy() {
stderr "Releasing local changes to personal deployment using skaffold"
swap_dockerfiles
skaffold run
}
while getopts "h" arg; do
case ${arg} in
h)
help
exit 0
;;
*)
stderr "Invalid option: '${arg}'"
help
exit 1
esac
done
setup
skaffold_deploy