Skip to content

Commit e959c0c

Browse files
Docker / build refactor & update Nginx (#69)
* Build with latest nginx version (1.21.6) Image builder now multi-stage Image builder uses debian:bullseye-slim to build module (same as official nginx image's base) Use nginx official image as final image base Now using sed to modify OOTB nginx.conf to load the module. Moved test-runner customisations into separate compose test stack Updated Makefile to use docker compose for tests. * Make org name, image name, compose project name, and nginx configurable via env vars. Clean up dangling stage images during build. * Removed copy of libjansson and libjwt from start-nginx target. Updated Readme. * Bumped default version to 1.22.0. Fix for v1.16.1. Test runner runs correct nginx version. Co-authored-by: Josh McCullough <[email protected]>
1 parent 148987d commit e959c0c

10 files changed

+121
-152
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMPOSE_PROJECT_NAME=jwt-nginx-test

Dockerfile

+35-92
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,40 @@
1-
FROM centos:7
1+
ARG NGINX_VERSION=1.22.0
22

3-
LABEL maintainer="TeslaGov" email="[email protected]"
4-
5-
ARG NGINX_VERSION=1.16.1
6-
ARG JANSSON_VERSION=2.13.1
7-
ARG LIBJWT_VERSION=1.12.0
8-
9-
ENV LD_LIBRARY_PATH=/usr/local/lib
10-
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/share/pkgconfig
11-
12-
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
13-
RUN echo "" >>/etc/yum.repos.d/nginx.repo
14-
RUN echo "[nginx]" >>/etc/yum.repos.d/nginx.repo
15-
RUN echo "name=nginx repo" >>/etc/yum.repos.d/nginx.repo
16-
RUN echo "baseurl=https://nginx.org/packages/centos/7/x86_64/" >>/etc/yum.repos.d/nginx.repo
17-
RUN echo "gpgcheck=0" >>/etc/yum.repos.d/nginx.repo
18-
RUN echo "enabled=1" >>/etc/yum.repos.d/nginx.repo
19-
20-
RUN yum -y update && \
21-
yum -y groupinstall 'Development Tools' && \
22-
yum -y install pcre-devel pcre zlib-devel openssl-devel wget cmake3 check-devel check && \
23-
yum -y install nginx-$NGINX_VERSION
24-
25-
# for compiling for epel7
26-
RUN yum -y install libxml2 libxslt libxml2-devel libxslt-devel gd gd-devel perl-ExtUtils-Embed geoip geoip-devel google-perftools google-perftools-devel
27-
28-
RUN mkdir -p /root/dl
29-
WORKDIR /root/dl
303

31-
# build jansson
32-
RUN wget https://github.com/akheron/jansson/archive/v$JANSSON_VERSION.zip && \
33-
unzip v$JANSSON_VERSION.zip && \
34-
rm v$JANSSON_VERSION.zip && \
35-
ln -sf jansson-$JANSSON_VERSION jansson && \
36-
cd /root/dl/jansson && \
37-
cmake3 . -DJANSSON_BUILD_SHARED_LIBS=1 -DJANSSON_BUILD_DOCS=OFF && \
38-
make && \
39-
make check && \
40-
make install
4+
FROM debian:bullseye-slim as BASE_IMAGE
5+
LABEL stage=builder
6+
RUN apt-get update \
7+
&& apt-get install -y curl build-essential
418

42-
# build libjwt
43-
RUN wget https://github.com/benmcollins/libjwt/archive/v$LIBJWT_VERSION.zip && \
44-
unzip v$LIBJWT_VERSION.zip && \
45-
rm v$LIBJWT_VERSION.zip && \
46-
ln -sf libjwt-$LIBJWT_VERSION libjwt && \
47-
cd /root/dl/libjwt && \
48-
autoreconf -i && \
49-
./configure && \
50-
make all && \
51-
make install
529

10+
FROM BASE_IMAGE as BUILD_IMAGE
11+
LABEL stage=builder
12+
ENV LD_LIBRARY_PATH=/usr/local/lib
13+
ARG NGINX_VERSION
5314
ADD . /root/dl/ngx-http-auth-jwt-module
54-
55-
# after 1.11.5 when compiling for a server that was compiled with --with-compat use this command
56-
# ./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-cc-opt='-std=gnu99'
57-
# cp /root/dl/nginx/objs/ngx_http_auth_jwt_module.so /etc/nginx/modules/.
58-
# build nginx module against nginx sources
59-
#
60-
# 1.10.2 from nginx by default use config flags... I had to add the -std=c99 and could not achieve "binary compatibility"
61-
# ./configure --add-dynamic-module=../ngx-http-auth-jwt-module --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-ipv6 --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=c99'
62-
#
63-
# rh-nginx110 uses these config flags
64-
# ./configure --add-dynamic-module=../ngx-http-auth-jwt-module --prefix=/opt/rh/rh-nginx110/root/usr/share/nginx --sbin-path=/opt/rh/rh-nginx110/root/usr/sbin/nginx --modules-path=/opt/rh/rh-nginx110/root/usr/lib64/nginx/modules --conf-path=/etc/opt/rh/rh-nginx110/nginx/nginx.conf --error-log-path=/var/opt/rh/rh-nginx110/log/nginx/error.log --http-log-path=/var/opt/rh/rh-nginx110/log/nginx/access.log --http-client-body-temp-path=/var/opt/rh/rh-nginx110/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/opt/rh/rh-nginx110/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/opt/rh/rh-nginx110/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/opt/rh/rh-nginx110/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/opt/rh/rh-nginx110/lib/nginx/tmp/scgi --pid-path=/var/opt/rh/rh-nginx110/run/nginx/nginx.pid --lock-path=/var/opt/rh/rh-nginx110/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -std=c99' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
65-
#
66-
# epel7 version 1.12.1 uses these config flags
67-
# ./configure --add-dynamic-module=../ngx-http-auth-jwt-module --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -std=gnu99' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
68-
#
69-
# epel7 version 1.16.1 uses these config flags
70-
# ./configure --add-dynamic-module=../ngx-http-auth-jwt-module --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-stream_ssl_preread_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-http_auth_request_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
71-
72-
# ARG CACHEBUST=1
73-
74-
RUN wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
75-
tar -xzf nginx-$NGINX_VERSION.tar.gz && \
76-
rm nginx-$NGINX_VERSION.tar.gz && \
77-
ln -sf nginx-$NGINX_VERSION nginx && \
78-
cd /root/dl/nginx && \
79-
./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-cc-opt='-std=gnu99' && \
80-
make modules && \
81-
cp /root/dl/nginx/objs/ngx_http_auth_jwt_module.so /usr/lib64/nginx/modules/.
82-
83-
# Get nginx ready to run
84-
COPY resources/nginx.conf /etc/nginx/nginx.conf
85-
COPY resources/test-jwt-nginx.conf /etc/nginx/conf.d/test-jwt-nginx.conf
86-
COPY resources/rsa_key_2048-pub.pem /etc/nginx/rsa-key.conf
87-
RUN rm -rf /usr/share/nginx/html
88-
RUN cp -r /root/dl/nginx/html /usr/share/nginx
89-
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure
90-
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure-rs256
91-
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure-auth-header
92-
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure-no-redirect
93-
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure-rs256-file
94-
95-
ENTRYPOINT ["/usr/sbin/nginx"]
96-
97-
EXPOSE 8000
15+
RUN set -x \
16+
&& apt-get install -y libjwt-dev libjwt0 libjansson-dev libjansson4 libpcre2-dev zlib1g-dev libpcre3-dev \
17+
&& mkdir -p /root/dl
18+
WORKDIR /root/dl
19+
RUN set -x \
20+
&& curl -O http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \
21+
&& tar -xzf nginx-$NGINX_VERSION.tar.gz \
22+
&& rm nginx-$NGINX_VERSION.tar.gz \
23+
&& ln -sf nginx-$NGINX_VERSION nginx \
24+
&& cd /root/dl/nginx \
25+
&& ./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module \
26+
&& make modules
27+
28+
29+
FROM nginx:${NGINX_VERSION}
30+
LABEL stage=builder
31+
RUN apt-get update \
32+
&& apt-get -y install libjansson4 libjwt0 \
33+
&& cd /etc/nginx \
34+
&& cp nginx.conf nginx.conf.orig \
35+
&& sed -ri '/pid\s+\/var\/run\/nginx\.pid;$/a load_module \/usr\/lib64\/nginx\/modules\/ngx_http_auth_jwt_module\.so;' nginx.conf
36+
37+
38+
LABEL stage=
39+
LABEL maintainer="TeslaGov" email="[email protected]"
40+
COPY --from=BUILD_IMAGE /root/dl/nginx/objs/ngx_http_auth_jwt_module.so /usr/lib64/nginx/modules/

Dockerfile-test

-4
This file was deleted.

Dockerfile-test-nginx

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ARG BASE_IMAGE=teslagov/jwt-nginx:latest
2+
3+
FROM ${BASE_IMAGE} as NGINX
4+
COPY resources/test-jwt-nginx.conf /etc/nginx/conf.d/test-jwt-nginx.conf
5+
COPY resources/rsa_key_2048-pub.pem /etc/nginx/rsa-key.conf
6+
RUN cp -r /usr/share/nginx/html /usr/share/nginx/secure \
7+
&& cp -r /usr/share/nginx/html /usr/share/nginx/secure-rs256 \
8+
&& cp -r /usr/share/nginx/html /usr/share/nginx/secure-rs256-file \
9+
&& cp -r /usr/share/nginx/html /usr/share/nginx/secure-auth-header \
10+
&& cp -r /usr/share/nginx/html /usr/share/nginx/secure-no-redirect

Dockerfile-test-runner

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM alpine:3.7
2+
COPY test.sh .
3+
RUN apk add curl bash
4+
CMD ["./test.sh"]

Makefile

+26-20
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,61 @@ GREEN := \033[0;32m
55
RED := \033[0;31m
66
NC := \033[0m
77

8-
DOCKER_ORG_NAME = teslagov
9-
DOCKER_IMAGE_NAME = jwt-nginx
8+
DOCKER_ORG_NAME ?= teslagov
9+
DOCKER_IMAGE_NAME ?= jwt-nginx
10+
COMPOSE_PROJECT_NAME ?= jwt-nginx-test
11+
NGINX_VERSION ?= 1.22.0
1012

1113
.PHONY: all
1214
all:
1315
@$(MAKE) build-nginx
14-
@$(MAKE) build-test-runner
1516
@$(MAKE) start-nginx
1617
@$(MAKE) test
1718

1819
.PHONY: build-nginx
1920
build-nginx:
2021
@echo "${BLUE} Building...${NC}"
21-
@docker image build -t $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME) . --build-arg NGINX_VERSION=${NGINX_VERSION} ; \
22-
if [ $$? -ne 0 ] ; \
22+
@docker image pull debian:bullseye-slim
23+
@docker image pull nginx:${NGINX_VERSION}
24+
@docker image build -t ${DOCKER_ORG_NAME}/${DOCKER_IMAGE_NAME}:latest -t ${DOCKER_ORG_NAME}/${DOCKER_IMAGE_NAME}:${NGINX_VERSION} --build-arg NGINX_VERSION=${NGINX_VERSION} . ; \
25+
SUCCESS=$$? ; \
26+
docker rmi $$(docker images --filter=label=stage=builder --quiet); \
27+
if [ "$$SUCCESS" -ne 0 ] ; \
2328
then echo "${RED} Build failed :(${NC}" ; \
2429
else echo "${GREEN}✓ Successfully built NGINX module ${NC}" ; fi
2530

2631
.PHONY: rebuild-nginx
2732
rebuild-nginx:
2833
@echo "${BLUE} Rebuilding...${NC}"
29-
@docker image build -t $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME) . --no-cache --build-arg NGINX_VERSION=${NGINX_VERSION} ; \
30-
if [ $$? -ne 0 ] ; \
34+
@docker image pull debian:bullseye-slim
35+
@docker image pull nginx:${NGINX_VERSION}
36+
@docker image build -t ${DOCKER_ORG_NAME}/${DOCKER_IMAGE_NAME}:latest -t ${DOCKER_ORG_NAME}/${DOCKER_IMAGE_NAME}:${NGINX_VERSION} --build-arg NGINX_VERSION=${NGINX_VERSION} . --no-cache ; \
37+
SUCCESS=$$? ; \
38+
docker rmi $$(docker images --filter=label=stage=builder --quiet); \
39+
if [ "$$SUCCESS" -ne 0 ] ; \
3140
then echo "${RED} Build failed :(${NC}" ; \
3241
else echo "${GREEN}✓ Successfully rebuilt NGINX module ${NC}" ; fi
3342

3443
.PHONY: stop-nginx
3544
stop-nginx:
36-
docker stop $(shell docker inspect --format="{{.Id}}" "$(DOCKER_IMAGE_NAME)-cont") ||:
45+
docker stop $(shell docker inspect --format="{{.Id}}" "$(DOCKER_IMAGE_NAME)") ||:
3746

3847
.PHONY: start-nginx
3948
start-nginx:
40-
docker run --rm --name "$(DOCKER_IMAGE_NAME)-cont" -d -p 8000:8000 $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
41-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/lib64/nginx/modules/ngx_http_auth_jwt_module.so .
42-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjansson.so.4.13.0 .
43-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.a .
44-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.la .
45-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/libjwt.so.0.7.0 .
46-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/pkgconfig/jansson.pc .
47-
docker cp $(DOCKER_IMAGE_NAME)-cont:/usr/local/lib/pkgconfig/libjwt.pc .
49+
docker run --rm --name "${DOCKER_IMAGE_NAME}" -d -p 8000:8000 ${DOCKER_ORG_NAME}/${DOCKER_IMAGE_NAME}
50+
docker cp ${DOCKER_IMAGE_NAME}:/usr/lib64/nginx/modules/ngx_http_auth_jwt_module.so .
4851

4952
.PHONY: build-test-runner
5053
build-test-runner:
51-
docker image build -f Dockerfile-test -t $(DOCKER_ORG_NAME)/jwt-nginx-test-runner .
54+
IMAGE_VERSION=${NGINX_VERSION} docker compose -f ./docker-compose-test.yml build
5255

53-
.PHONY: frebuild-test-runner
56+
.PHONY: rebuild-test-runner
5457
rebuild-test-runner:
55-
docker image build -f Dockerfile-test -t $(DOCKER_ORG_NAME)/jwt-nginx-test-runner . --no-cache
58+
IMAGE_VERSION=${NGINX_VERSION} docker compose -f ./docker-compose-test.yml build --no-cache
5659

5760
.PHONY: test
5861
test:
59-
docker run --rm $(DOCKER_ORG_NAME)/jwt-nginx-test-runner
62+
IMAGE_VERSION=${NGINX_VERSION} docker compose -f ./docker-compose-test.yml up --no-start
63+
docker start ${COMPOSE_PROJECT_NAME}-nginx-1
64+
docker start -a ${COMPOSE_PROJECT_NAME}-runner-1
65+
docker compose -f ./docker-compose-test.yml down

README.md

+15-17
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@ When you make a change to the module, run `make rebuild-nginx`.
1111

1212
When you make a change to `test.sh`, run `make rebuild-test-runner`.
1313

14-
| Command | Description |
15-
| -------------------------- |:-------------------------------------------:|
16-
| `make build-nginx` | Builds the NGINX image |
17-
| `make rebuild-nginx` | Re-builds the NGINX image |
18-
| `make build-test-runner` | Builds the image that will run `test.sh` |
19-
| `make rebuild-test-runner` | Re-builds the image that will run `test.sh` |
20-
| `make start-nginx` | Starts the NGINX container |
21-
| `make stop-nginx` | Stops the NGINX container |
22-
| `make test` | Runs `test.sh` against the NGINX container |
23-
24-
You can re-run tests as many times as you like while NGINX is up.
25-
When you're done running tests, make sure to stop the NGINX container.
26-
27-
The Dockerfile builds all of the dependencies as well as the module,
28-
downloads a binary version of NGINX, and runs the module as a dynamic module.
29-
30-
Tests get executed in containers. This project is 100% Docker-ized.
14+
| Command | Description |
15+
| -------------------------- |:-----------------------------------------------------------------:|
16+
| `make build-nginx` | Builds the NGINX image |
17+
| `make rebuild-nginx` | Re-builds the NGINX image |
18+
| `make build-test-runner` | Builds the images used by the test stack (uses Docker compose) |
19+
| `make rebuild-test-runner` | Re-builds the images used by the test stack |
20+
| `make start-nginx` | Starts the NGINX container |
21+
| `make stop-nginx` | Stops the NGINX container |
22+
| `make test` | Runs `test.sh` against the NGINX container (uses Docker compose) |
23+
24+
The image produced with `make build-nginx` only differs from the official Nginx image in two ways: the module itself and the nginx.conf configuration entry that loads it.
25+
26+
The tests use a customized Nginx image, distinct from the main image, as well as a test runner image. By running `make test`, the two test containers will be created up with Docker compose, started, and the tests run. At the end, both containers will be automatically stopped and destroyed.
27+
28+
This project is 100% Docker-ized.
3129

3230
## Dependencies
3331
This module depends on the [JWT C Library](https://github.com/benmcollins/libjwt)

docker-compose-test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.3'
2+
3+
services:
4+
5+
nginx:
6+
build:
7+
context: .
8+
dockerfile: Dockerfile-test-nginx
9+
args:
10+
BASE_IMAGE: ${IMAGE_NAME:-teslagov/jwt-nginx}:${IMAGE_VERSION:-latest}
11+
12+
runner:
13+
build:
14+
context: .
15+
dockerfile: Dockerfile-test-runner
16+
environment:
17+
BASE_IMAGE: ${IMAGE_NAME:-teslagov/jwt-nginx}:${IMAGE_VERSION:-latest}
18+
19+
depends_on:
20+
- nginx-test

0 commit comments

Comments
 (0)