-
Notifications
You must be signed in to change notification settings - Fork 0
/
prodbuild.sh
executable file
·40 lines (32 loc) · 1.38 KB
/
prodbuild.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
#!/bin/bash
CMD="$1"
if [ x"$CMD" = x ]; then
echo "provide a command!"
exit 1
fi
if [ "$CMD" = "frontend" ] || [ "$CMD" = "all" ]; then
\rm -f nginx-prod/build/*.tgz
mkdir -p nginx-prod/build/
# build the frontend assets (this takes quite a while due to minification)
echo "building frontend assets"
# docker-compose -f docker-compose-buildjs.yml run frontend
# docker-compose -f docker-compose-buildjs.yml stop
frontend/build.sh
# build the django assets
echo "building django assets"
docker-compose -f docker-compose-buildpy.yml build
docker-compose -f docker-compose-buildpy.yml run django
docker-compose -f docker-compose-buildpy.yml stop
# copy assets locally for build local production nginx image (local testing only)
cp build/frontend.tgz build/django.tgz nginx-prod/build # this is horrible, fixme
# For local testing with docker-compose-prod.yml only
echo "building prod nginx container for local testing"
(cd nginx-prod && docker build -t scremsong/nginx-prod:latest .)
(cd nginx-prod && docker build --no-cache -t scremsong/nginx-prod:latest . && cd ..)
fi
if [ "$CMD" = "django" ] || [ "$CMD" = "all" ]; then
echo building prod django container
(cd django && docker build -t scremsong/django:latest .)
# (cd django && docker build --no-cache -t scremsong/django:latest . && cd ..)
# rm django/scremsong/ealfront/templates/index.html
fi