forked from nginx-with-docker/ngx_http_waf_module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-image.sh
32 lines (25 loc) · 1000 Bytes
/
make-image.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
#!/bin/bash
PROJECT_NAME="waf"
RELEASE_DIR="./docker";
REPO_NAME="soulteary/prebuilt-nginx-modules"
for subVer in $RELEASE_DIR/*; do
set -a
. "$subVer/.env"
set +a
REPO_TAG="ngx-$NGINX_VERSION-$PROJECT_NAME-$MODULE_VERSION";
BUILD_ARGS=$(tr '\n' ';' < "$subVer/.env" | sed 's/;$/\n/' | sed 's/^/ --build-arg /' | sed 's/;/ --build-arg /g')
if [ -f "$subVer/Dockerfile.alpine" ]; then
BUILD_NAME="$REPO_NAME:$REPO_TAG-alpine"
if [[ "$(docker images -q $BUILD_NAME 2> /dev/null)" == "" ]]; then
echo "Build: $BUILD_NAME";
docker build $BUILD_ARGS --tag $BUILD_NAME -f $subVer/Dockerfile.alpine .
fi
fi
if [ -f "$subVer/Dockerfile.debian" ]; then
BUILD_NAME="$REPO_NAME:$REPO_TAG"
if [[ "$(docker images -q $BUILD_NAME 2> /dev/null)" == "" ]]; then
echo "Build: $BUILD_NAME";
docker build $BUILD_ARGS --tag $BUILD_NAME -f $subVer/Dockerfile.debian .
fi
fi
done