-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·92 lines (81 loc) · 1.75 KB
/
build.sh
File metadata and controls
executable file
·92 lines (81 loc) · 1.75 KB
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
84
85
86
87
88
89
90
91
92
#!/bin/bash
#########################################
# A script to build code to Docker images
#########################################
#
# Ensure that we are in the folder containing this script
#
cd "$(dirname "${BASH_SOURCE[0]}")"
#
# Default to running APIs locally, with Kafka always running in Docker
#
if [ "$PROFILE" != 'DEPLOYED' ]; then
PROFILE='LOCAL'
fi
#
# Build the Docker image for the API gateway
#
docker build --no-cache -f api-gateway/Dockerfile -t custom_kong:3.8 .
if [ $? -ne 0 ]; then
echo "Problem encountered building the API gateway Docker image"
exit 1
fi
#
# Install dependencies
#
cd orders-api
npm install
if [ $? -ne 0 ]; then
echo "Problem encountered installing Orders API dependencies"
exit 1
fi
cd ..
#
# Install dependencies
#
cd invoices-api
npm install
if [ $? -ne 0 ]; then
echo "Problem encountered installing Invoices API dependencies"
exit 1
fi
cd ..
#
# Build Docker images for deployed APIs if required
#
if [ "$PROFILE" == 'DEPLOYED' ]; then
#
# Build the Orders API Docker image
#
cd orders-api
npm run build
if [ $? -ne 0 ]; then
echo "Problem encountered building Orders API code"
exit 1
fi
if [ "$PROFILE" == 'DEPLOYED' ]; then
docker build -t orders-api:1.0.0 .
if [ $? -ne 0 ]; then
echo "Problem encountered building the Orders API Docker image"
exit 1
fi
fi
cd ..
#
# Build the Invoices API Docker image
#
cd invoices-api
npm run build
if [ $? -ne 0 ]; then
echo "Problem encountered building Invoices API code"
exit 1
fi
if [ "$PROFILE" == 'DEPLOYED' ]; then
docker build -t invoices-api:1.0.0 .
if [ $? -ne 0 ]; then
echo "Problem encountered building the Orders API Docker image"
exit 1
fi
fi
cd ..
fi