Verified Commit 14c8e475 authored by tr's avatar tr
Browse files

Build modsecurity-nginx

parent d2a194aa
FROM centos:8 AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
RUN dnf install -y epel-release sudo && \
dnf groupinstall -y 'Development Tools' 'RPM Development Tools' && \
rm -rf /var/cache/* /var/log/*
......@@ -31,3 +28,28 @@ RUN cd /usr/local/src/modsecurity-v$MODSECURITY_VERSION && \
./configure && \
make && \
sudo make install
# Build modsecurity-nginx
ENV MODSECURITY_NGINX_VERSION 1.0.1
RUN curl -L https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v$MODSECURITY_NGINX_VERSION/modsecurity-nginx-v$MODSECURITY_NGINX_VERSION.tar.gz \
-o /usr/local/src/modsecurity-nginx.tar.gz && \
tar -zxC /usr/local/src -f /usr/local/src/modsecurity-nginx.tar.gz
RUN cd /usr/local/src && \
dnf download --source nginx && \
sudo dnf builddep -y nginx-*.src.rpm && \
sudo dnf install -y nginx && \
sudo rm -rf /var/cache/* /var/log/*
RUN cd /usr/local/src && \
CONFARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') && \
rpmdev-setuptree && \
rpmbuild -rp nginx-*.src.rpm && \
cd $HOME/rpmbuild/BUILD/nginx-* && \
eval ./configure \
--with-compat \
$CONFARGS \
--add-dynamic-module=/usr/local/src/modsecurity-nginx-v$MODSECURITY_NGINX_VERSION && \
make modules && \
cp objs/ngx_http_modsecurity_module.so /usr/local/src/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment