-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_staging.sh
executable file
·53 lines (42 loc) · 1.67 KB
/
build_staging.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
#!/bin/bash
CMD="$1"
LATEST_IMAGE_TAG="latest-staging"
if [ x"$CMD" = x ]; then
echo "provide a command!"
exit 1
fi
if [ "$CMD" = "full-run" ]; then
echo "Build - Prep"
rm -rf ./nginx-prod/build/
mkdir ./nginx-prod/build
fi
if [ "$CMD" = "django-only" ] || [ "$CMD" = "full-run" ]; then
echo -e "\n\n Django - Build Static Assets"
docker compose --file build_staging.yml run django
echo -e "\n\n Containers - Build Django"
cd django && docker build -t keithmoss/demsausage-django:$LATEST_IMAGE_TAG . && cd ../
fi
if [ "$CMD" = "frontend-only" ] || [ "$CMD" = "full-run" ]; then
echo -e "\n\n Public Frontend - Build"
docker compose --file build_staging.yml run public
echo -e "\n\n Public Redesign - Build"
docker compose --file build_staging.yml run public_redesign
echo -e "\n\n Admin - Build"
docker compose --file build_staging.yml run admin
echo -e "\n\n Containers - Build Nginx"
cd nginx-prod && docker build -t keithmoss/demsausage-nginx:$LATEST_IMAGE_TAG . && cd ../
fi
if [ "$CMD" = "full-run" ]; then
echo -e "\n\n Containers - Build RQ Dashboard"
cd rq-dashboard && docker build -t keithmoss/demsausage-rq-dashboard:$LATEST_IMAGE_TAG . && cd ../
fi
# Containers - Push to Docker Hub
if [ "$CMD" = "django-only" ]; then
docker push keithmoss/demsausage-django:$LATEST_IMAGE_TAG
elif [ "$CMD" = "frontend-only" ]; then
docker push keithmoss/demsausage-nginx:$LATEST_IMAGE_TAG
elif [ "$CMD" = "full-run" ]; then
docker push keithmoss/demsausage-nginx:$LATEST_IMAGE_TAG
docker push keithmoss/demsausage-django:$LATEST_IMAGE_TAG
docker push keithmoss/demsausage-rq-dashboard:$LATEST_IMAGE_TAG
fi