Add tests for nginx.conf directives (#1)
Adds tests to make sure all the `nginx.conf` directives (the redirects and rewrites and such) are all correct. - Uses the `busted` framework - The tests are run in a Docker container by the bash script `test.sh` - Self-signed certs are generated in `Dockerfile` for all the domain names - Adds new `Makefile` commands: `test`, `image-build` and `image-rm` Reviewed-on: #1 Co-authored-by: Catalin Mititiuc <webdevcat@proton.me> Co-committed-by: Catalin Mititiuc <webdevcat@proton.me>
This commit is contained in:
24
Dockerfile
24
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM openresty/openresty:1.27.1.2-0-bookworm-buildpack
|
||||
FROM openresty/openresty:bookworm-buildpack
|
||||
|
||||
WORKDIR /opt/app
|
||||
|
||||
@@ -11,7 +11,27 @@ RUN apt-get update && apt-get install -y \
|
||||
wget -q -O $pkgname $pkgurl && dpkg -i $pkgname && rm $pkgname
|
||||
|
||||
RUN luarocks install sitegen
|
||||
RUN luarocks install busted
|
||||
|
||||
# needed for sitegen watcher
|
||||
RUN luarocks install inotify INOTIFY_INCDIR=/usr/include/x86_64-linux-gnu/
|
||||
|
||||
# needed for testing
|
||||
RUN luarocks install busted
|
||||
RUN luarocks install luajit-curl
|
||||
RUN luarocks install luasocket # needed for testing nginx reverse proxy
|
||||
|
||||
RUN mkdir -p /var/www/certs/miti.sh \
|
||||
&& openssl req -x509 -newkey rsa:4096 -nodes \
|
||||
-keyout /var/www/certs/miti.sh/privkey.pem \
|
||||
-out /var/www/certs/miti.sh/fullchain.pem \
|
||||
-sha256 -days 365 -subj '/CN=miti.sh' \
|
||||
-addext "subjectAltName=DNS:miti.sh,DNS:git.miti.sh,DNS:apps.miti.sh"
|
||||
|
||||
RUN mkdir -p /var/www/certs/webdevcat.me \
|
||||
&& openssl req -x509 -newkey rsa:4096 -nodes \
|
||||
-keyout /var/www/certs/webdevcat.me/privkey.pem \
|
||||
-out /var/www/certs/webdevcat.me/fullchain.pem \
|
||||
-sha256 -days 365 -subj '/CN=webdevcat.me' \
|
||||
-addext "subjectAltName=DNS:webdevcat.me,DNS:git.webdevcat.me,DNS:apps.webdevcat.me"
|
||||
|
||||
CMD ["sh", "-c", "openresty -p `pwd` -g 'daemon off;'"]
|
||||
|
||||
Reference in New Issue
Block a user