This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.sh
83 lines (67 loc) · 2.1 KB
/
build.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
78
79
80
81
82
83
#!/bin/sh
BACKEND_MERGE='dipugodocker/pdf-editor:backend-merge'
BACKEND_ROTATE='dipugodocker/pdf-editor:backend-rotate'
FRONTEND='dipugodocker/pdf-editor:frontend'
# building the docker images
backend_docker_build_dev() {
echo '[🙂] Building for Devlopment [Backend-merger]'
cd src/backend/merger && docker build --target dev -t $BACKEND_MERGE .
echo '[🙂] Building for Devlopment [Backend-rotator]'
cd ../rotator && docker build --target dev -t $BACKEND_ROTATE .
}
frontend_docker_build_dev() {
echo '[🙂] Building Dev [Frontend]'
cd ../../frontend && docker build --target dev -t $FRONTEND .
}
# building the docker images
backend_docker_build_prod() {
echo '[🏭] Building for Production [Backend-merger]'
cd src/backend/merger && docker build --target prod -t $BACKEND_MERGE . --no-cache
echo '[🏭] Building for Production [Backend-rotator]'
cd ../rotator && docker build --target prod -t $BACKEND_ROTATE . --no-cache
}
frontend_docker_build_prod() {
echo '[🏭] Building Prod [Frontend]'
cd ../../frontend && docker build --target prod -t $FRONTEND . --no-cache
}
# building the docker images
backend_docker_build_test() {
echo '[🧪] Building for Testing [Backend-merger]'
cd src/backend/merger && docker build --target test -t $BACKEND_MERGE . --no-cache
echo '[🧪] Building for Testing [Backend-rotator]'
cd ../rotator && docker build --target test -t $BACKEND_ROTATE . --no-cache
}
frontend_docker_build_test() {
echo '[🧪] Building Test [Frontend]'
cd ../../frontend && docker build --target test -t $FRONTEND . --no-cache
}
# echo 'Enter 0 for prod, 1 for dev, 2 for test'
# read choice
if [ $# != 1 ]; then
echo -n "
Help [1 argument required]
0 Production
1 Development
2 Testing
"
exit 1
fi
choice=$1
if [ $choice -eq 0 ]
then
backend_docker_build_prod
frontend_docker_build_prod
elif [ $choice -eq 1 ]
then
backend_docker_build_dev
frontend_docker_build_dev
elif [ $choice -eq 2 ]
then
backend_docker_build_test
frontend_docker_build_test
else
echo 'Invalid request'
return 1
fi
echo 'docker container ps'
docker images | grep pdf-editor | head -n4