-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild-nginx-plus.sh
executable file
·103 lines (82 loc) · 2.86 KB
/
build-nginx-plus.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Usage EXAMPLE: ./build-nginx-plus.sh ubuntu18.04
distro="$(tr [A-Z] [a-z] <<< "$1")" # set to lowercase
# Check Dockerfile type
is_controller='_controller'
is_nap='_nap'
is_nim='_nim'
# Set build directory
build_dir=''
# Optional: Pull Git changes
# git pull --no-edit
#
# Build Controller Agent Docker container
#
if grep -q "$is_controller" <<< "$distro"; then
# Set build directory
build_dir='./CONTROLLER-AGENT'
# remove Dockerfile here (if exists)
rm $build_dir/Dockerfile || true
# copy desired Dockerfile
cp Dockerfiles/$distro/Dockerfile $build_dir
# Build and tag it as "nginx-agent-[distro]"
docker build -t nginx-agent-$distro $build_dir --pull --no-cache # No caching
# Show all docker containers build with names containing "nginx-plus-"
printf "\n"
printf "Nginx Plus with Controller Agent containers built:"
printf "\n"
docker images | grep nginx-agent
#
# Build NGINX App Protect Docker container
#
elif grep -q "$is_nap" <<< "$distro"; then
# Set build directory
build_dir='./NAP'
# remove Dockerfile here (if exists)
rm $build_dir/Dockerfile || true
# copy desired Dockerfile
cp Dockerfiles/$distro/Dockerfile $build_dir
# Build and tag it as "nginx-app-protect-[distro]"
docker build -t nginx-app-protect-$distro $build_dir --pull --no-cache # No caching
# Show all docker containers build with names containing "nginx-plus-"
printf "\n"
printf "Nginx App Protect containers built:"
printf "\n"
docker images | grep nginx-app-protect
#
# Build NGINX Instance Manager ("NIM") Docker container
#
elif grep -q "$is_nim" <<< "$distro"; then
# Set build directory
build_dir='./NIM'
# remove Dockerfile here (if exists)
rm $build_dir/Dockerfile || true
# copy desired Dockerfile
cp Dockerfiles/$distro/Dockerfile $build_dir
# Build and tag it as "nginx-nim-protect-[distro]"
docker build -t nginx-nim-$distro $build_dir --pull --no-cache # No caching
# Show all docker containers build with names containing "nginx-plus-"
printf "\n"
printf "Nginx Instance Manager (NIM) containers built:"
printf "\n"
docker images | grep nginx-nim
#
# Build NGINX Plus Docker container
#
else
# Set build directory
build_dir='./NGINX-PLUS'
# remove Dockerfile here (if exists)
rm $build_dir/Dockerfile || true
# copy desired Dockerfile
cp Dockerfiles/$distro/Dockerfile $build_dir
# Build and tag it as "nginx-plus-[distro]"
docker build -t nginx-plus-$distro $build_dir --pull --no-cache # No caching
# Show all docker containers build with names containing "nginx-plus-"
printf "\n"
printf "Nginx Plus containers built:"
printf "\n"
docker images | grep nginx-plus
fi
# remove Dockerfile from the build directory (if exists)
rm $build_dir/Dockerfile || true