Pre-compiled builder image for Nginx with ModSecurity v3 and OWASP CRS.
383
This repository provides a Docker image containing pre-compiled binaries for ModSecurity v3 (Libmodsecurity), the ModSecurity-nginx connector, and the OWASP ModSecurity Core Rule Set (CRS).
It is designed to be used as a Builder Stage in multi-stage Docker builds. By using this image, you can significantly reduce the build time of your Nginx WAF container, as you no longer need to compile ModSecurity from source every time.
Use this image in your Dockerfile to copy the compiled artifacts (modules and configuration files).
ARG NGINX_VERSION="1.29.2"
# Step 1: Resource Provider (This image)
FROM procube/nginx-modsec-builder:${NGINX_VERSION} AS builder
# Step 2: Runner (Your production image)
FROM nginx:${NGINX_VERSION}
# Install runtime dependencies (much lighter than build tools)
RUN apt update && apt install -y \
libxml2 libyajl2 libgeoip1 liblmdb0 libcurl4 \
&& rm -rf /var/lib/apt/lists/*
# Copy artifacts from the builder
COPY --from=builder /usr/local/modsecurity /usr/local/modsecurity
COPY --from=builder /opt/nginx-${NGINX_VERSION}/objs/ngx_http_modsecurity_module.so /usr/lib/nginx/modules/
# Copy configuration files
COPY --from=builder /opt/ModSecurity/modsecurity.conf-recommended /etc/nginx/modsecurity.conf
COPY --from=builder /opt/ModSecurity/unicode.mapping /etc/nginx/unicode.mapping
COPY --from=builder /opt/owasp-crs /etc/nginx/owasp-crs
# ... Add your nginx.conf and other settings here ...
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This Docker image is built upon several open-source projects. We are grateful to the communities behind them.
This project contains software developed by the ModSecurity project and the OWASP Core Rule Set project.
For developers interested in contributing or understanding the CI/CD setup, see docs/ci-cd.md in the repository.
Content type
Image
Digest
sha256:49ff2eff0…
Size
597 MB
Last updated
7 months ago
docker pull procube/nginx-modsec-builder:1.29.5