File tree Expand file tree Collapse file tree 12 files changed +64
-183
lines changed Expand file tree Collapse file tree 12 files changed +64
-183
lines changed Original file line number Diff line number Diff line change 55set -o pipefail
66
77
8- # ##
9- # ## Variables
10- # ##
11- CWD=" $( dirname " ${0} " ) "
12-
13-
148# ##
159# ## Run
1610# ##
@@ -45,9 +39,3 @@ function get_random_name() {
4539 done
4640 echo " ${name} "
4741}
48-
49-
50- DOCKER_IMAGE=" $( grep ' image=".*"' " ${CWD} /../Dockerfile" | sed ' s/^[[:space:]]*//g' | awk -F' "' ' {print $2}' ) "
51- DOCKER_VENDOR=" $( grep ' vendor=".*"' " ${CWD} /../Dockerfile" | sed ' s/^[[:space:]]*//g' | awk -F' "' ' {print $2}' ) "
52- # shellcheck disable=SC2034
53- DOCKER_NAME=" ${DOCKER_VENDOR} /${DOCKER_IMAGE} "
Original file line number Diff line number Diff line change 55set -o pipefail
66
77CWD=" $( cd -P -- " $( dirname -- " $0 " ) " && pwd -P) "
8+ DOCKER_NAME=" ${1} "
89
910
1011# ##
@@ -23,12 +24,6 @@ RAND_NAME="$( get_random_name )"
2324run " echo \" hello world\" > ${RAND_DIR} /index.html"
2425
2526
26- # ##
27- # ## Build container
28- # ##
29- run " docker build -t ${DOCKER_NAME} ${CWD} /.."
30-
31-
3227# ##
3328# ## Startup container
3429# ##
@@ -48,8 +43,8 @@ run "docker run -d --rm \
4843run " sleep 5"
4944run " docker ps"
5045run " docker logs ${RAND_NAME} "
51- run " curl localhost"
52- run " curl localhost | grep 'hello world'"
46+ run " curl -sS localhost/index.html "
47+ run " curl -sS localhost/index.html | grep 'hello world'"
5348
5449
5550# ##
Original file line number Diff line number Diff line change 55set -o pipefail
66
77CWD=" $( cd -P -- " $( dirname -- " $0 " ) " && pwd -P) "
8+ DOCKER_NAME=" ${1} "
89
910
1011# ##
@@ -21,13 +22,7 @@ CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
2122RAND_DIR=" $( mktemp -d ) "
2223RAND_NAME1=" $( get_random_name ) "
2324RAND_NAME2=" $( get_random_name ) "
24- run " echo \" <?php echo 'hello world php';\" > ${RAND_DIR} /index.php"
25-
26-
27- # ##
28- # ## Build container
29- # ##
30- run " docker build -t ${DOCKER_NAME} ${CWD} /.."
25+ run " echo \" <?php echo 'h'.'e'.'llo world php';\" > ${RAND_DIR} /index.php"
3126
3227
3328# ##
@@ -61,8 +56,8 @@ run "sleep 5"
6156run " docker ps"
6257run " docker logs ${RAND_NAME1} "
6358run " docker logs ${RAND_NAME2} "
64- run " curl localhost"
65- run " curl localhost | grep 'hello world php'"
59+ run " curl -sS localhost"
60+ run " curl -sS localhost | grep 'hello world php'"
6661
6762
6863# ##
Original file line number Diff line number Diff line change @@ -12,27 +12,11 @@ IFS=$'\n'
1212
1313# Current directory
1414CWD=" $( dirname " ${0} " ) "
15+ IMAGE=" ${1} "
1516
1617declare -a TESTS=()
1718
1819
19- # ##
20- # ## Sanity checks
21- # ##
22-
23- # Check Dockerfile
24- if [ ! -f " ${CWD} /../Dockerfile" ]; then
25- echo " Dockerfile not found in: ${CWD} /../Dockerfile."
26- exit 1
27- fi
28-
29- # Check docker Name
30- if ! grep -q ' image=".*"' " ${CWD} /../Dockerfile" > /dev/null 2>&1 ; then
31- echo " No 'image' LABEL found"
32- exit
33- fi
34-
35-
3620# ##
3721# ## Run tests
3822# ##
@@ -44,13 +28,13 @@ for f in ${FILES}; do
4428done
4529
4630# Start a single test
47- if [ " ${# } " -eq " 1 " ]; then
48- sh -c " ${TESTS[${1}] } "
31+ if [ " ${# } " -eq " 2 " ]; then
32+ sh -c " ${TESTS[${2}]} ${IMAGE }"
4933
5034# Run all tests
5135else
5236 for i in " ${TESTS[@]} " ; do
53- echo " sh -c ${CWD} /${i} "
54- sh -c " ${i} "
37+ echo " sh -c ${CWD} /${i} ${IMAGE} "
38+ sh -c " ${i} ${IMAGE} "
5539 done
5640fi
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ install:
5252 - max=100; i=0; while [ $i -lt $max ]; do if sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce; then break; else i=$((i+1)); fi done
5353 - docker version
5454script :
55- - .ci/start-ci.sh "${TEST}" "${IMAGE}"
55+ - make build
56+ - make test ARG=${TEST}
5657
5758
5859# ##
Original file line number Diff line number Diff line change 11FROM nginx:mainline
22MAINTAINER "cytopia" <cytopia@everythingcli.org>
33
4+ LABEL \
5+ name="cytopia's nginx mainline image" \
6+ image="devilbox/nginx-mainline" \
7+ vendor="devilbox" \
8+ license="MIT"
49
510# ##
611# ## Build arguments
712# ##
8- ARG VHOST_GEN_GIT_REF=0.7
13+ ARG VHOST_GEN_GIT_REF=0.10
914ARG CERT_GEN_GIT_REF=0.2
1015
1116ENV BUILD_DEPS \
Original file line number Diff line number Diff line change 1+ image = devilbox/nginx-mainline
2+
3+ help :
4+ @printf " %s\n" " make build: Build"
5+ @printf " %s\n" " make rebuild: Rebuild"
6+ @printf " %s\n" " make test: Test"
7+
8+
9+ build : pull
10+ docker build -t $(image ) .
11+ cd build; ./gen-readme.sh $(image )
12+
13+ rebuild : pull
14+ docker build --no-cache -t $(image ) .
15+ cd build; ./gen-readme.sh $(image )
16+
17+ test :
18+ .ci/start-ci.sh $(image ) $(ARG )
19+
20+ pull :
21+ docker pull $(shell grep FROM Dockerfile | sed 's/^FROM//g'; done)
Original file line number Diff line number Diff line change @@ -255,5 +255,5 @@ It allows any of the following combinations:
255255## Version
256256
257257```
258- nginx version: nginx/1.13.12
258+ nginx version: nginx/1.15.2
259259```
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments